Decode unmarshals the underlying value attached to the Array to a target variable. target should be one of these: - pointer to an empty interface - pointer to a slice of any type Example: type S struct{ Foo int `json:foo` } value := []interface{}{ map[string]interface{}{ "foo": 123, }
(target interface{})
| 96 | // |
| 97 | // assert.Equal(t, []S{{123}, {456}}, target) |
| 98 | func (a *Array) Decode(target interface{}) *Array { |
| 99 | opChain := a.chain.enter("Decode()") |
| 100 | defer opChain.leave() |
| 101 | |
| 102 | if opChain.failed() { |
| 103 | return a |
| 104 | } |
| 105 | |
| 106 | canonDecode(opChain, a.value, target) |
| 107 | return a |
| 108 | } |
| 109 | |
| 110 | // Alias is similar to Value.Alias. |
| 111 | func (a *Array) Alias(name string) *Array { |