1
0
mirror of https://github.com/json-iterator/go.git synced 2025-06-24 23:16:47 +02:00

#63 support *json.RawMessage

This commit is contained in:
Tao Wen
2017-06-19 22:57:43 +08:00
parent 3b883aeffc
commit 50583f6bae
2 changed files with 21 additions and 1 deletions

View File

@ -391,7 +391,7 @@ func createEncoderOfType(cfg *frozenConfig, typ reflect.Type) (Encoder, error) {
}
if typ.ConvertibleTo(marshalerType) {
templateInterface := reflect.New(typ).Elem().Interface()
return &marshalerEncoder{extractInterface(templateInterface)}, nil
return &optionalEncoder{&marshalerEncoder{extractInterface(templateInterface)}}, nil
}
if typ.ConvertibleTo(anyType) {
return &anyCodec{}, nil