You've already forked json-iterator
mirror of
https://github.com/json-iterator/go.git
synced 2025-06-18 22:57:33 +02:00
#31 support json.RawMessage
This commit is contained in:
@ -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]`)
|
||||
|
Reference in New Issue
Block a user