1
0
mirror of https://github.com/json-iterator/go.git synced 2025-06-18 22:57:33 +02:00

support json.RawMessage

This commit is contained in:
Tao Wen
2017-06-02 10:50:23 +08:00
parent ad3a7fde32
commit fe9fa8900e
4 changed files with 46 additions and 6 deletions

@ -253,6 +253,16 @@ func Test_write_array_of_interface_in_struct(t *testing.T) {
should.Equal(`{"Field":[1,2],"Field2":""}`, str)
}
func Test_json_RawMessage(t *testing.T) {
should := require.New(t)
var data json.RawMessage
should.Nil(Unmarshal([]byte(`[1,2,3]`), &data))
should.Equal(`[1,2,3]`, string(data))
str, err := MarshalToString(data)
should.Nil(err)
should.Equal(`[1,2,3]`, str)
}
func Benchmark_jsoniter_array(b *testing.B) {
b.ReportAllocs()
input := []byte(`[1,2,3,4,5,6,7,8,9]`)