MCPcopy Create free account
hub / github.com/aws/smithy-go / DecodeJSONInterface

Method DecodeJSONInterface

document/json/decoder.go:34–46  ·  view source on GitHub ↗

DecodeJSONInterface decodes the supported JSON input types and stores the result in the value pointed by toValue. If toValue is not a compatible type, or an error occurs while decoding DecodeJSONInterface will return an error. The supported input JSON types are: bool -> JSON boolean float64 -> JSO

(input interface{}, toValue interface{})

Source from the content-addressed store, hash-verified

32// nil -> JSON null
33//
34func (d *Decoder) DecodeJSONInterface(input interface{}, toValue interface{}) error {
35 if document.IsNoSerde(toValue) {
36 return fmt.Errorf("unsupported type: %T", toValue)
37 }
38
39 v := reflect.ValueOf(toValue)
40
41 if v.Kind() != reflect.Ptr || v.IsNil() || !v.IsValid() {
42 return &document.InvalidUnmarshalError{Type: reflect.TypeOf(toValue)}
43 }
44
45 return d.decode(input, v, serde.Tag{})
46}
47
48func (d *Decoder) decode(jv interface{}, rv reflect.Value, tag serde.Tag) error {
49 if jv == nil {

Callers 3

testDecodeJSONInterfaceFunction · 0.95
TestNoSerdeFunction · 0.80

Calls 4

decodeMethod · 0.95
IsNoSerdeFunction · 0.92
ErrorfMethod · 0.80
IsValidMethod · 0.80

Tested by 3

testDecodeJSONInterfaceFunction · 0.76
TestNoSerdeFunction · 0.64