1
0
mirror of https://github.com/json-iterator/go.git synced 2024-11-27 08:30:57 +02:00

#76 fix UnmarshalJSON

This commit is contained in:
Tao Wen 2017-06-28 23:55:32 +08:00
parent 82dabdcdbf
commit 08dbc98040

View File

@ -267,6 +267,11 @@ func createDecoderOfType(cfg *frozenConfig, typ reflect.Type) (ValDecoder, error
}
return decoder, nil
}
if reflect.PtrTo(typ).ConvertibleTo(unmarshalerType) {
templateInterface := reflect.New(typ).Interface()
var decoder ValDecoder = &unmarshalerDecoder{extractInterface(templateInterface)}
return decoder, nil
}
if typ.ConvertibleTo(anyType) {
return &anyCodec{}, nil
}