1
0
mirror of https://github.com/json-iterator/go.git synced 2025-12-17 23:27:37 +02:00

#63 support decode anonymous struct

This commit is contained in:
Tao Wen
2017-06-19 23:02:57 +08:00
parent 50583f6bae
commit eecb062c32
3 changed files with 26 additions and 6 deletions

View File

@@ -128,6 +128,12 @@ func Test_decode_map_of_raw_message(t *testing.T) {
var rawMap RawMap
should.Nil(Unmarshal(b, &rawMap))
should.Equal(`[{"key":"value"}]`, string(*rawMap["test"]))
type Inner struct {
Key string `json:"key"`
}
var inner []Inner
Unmarshal(*rawMap["test"], &inner)
should.Equal("value", inner[0].Key)
}
func Test_encode_map_of_raw_message(t *testing.T) {