1
0
mirror of https://github.com/json-iterator/go.git synced 2025-08-13 22:12:45 +02:00

support read interface{} as json.Number

This commit is contained in:
Tao Wen
2017-06-18 15:22:37 +08:00
parent 77dcffe77d
commit 7a049ec79c
3 changed files with 31 additions and 10 deletions

@@ -152,3 +152,13 @@ func Test_nil_non_empty_interface(t *testing.T) {
should.NotNil(json.Unmarshal(b, &obj))
should.NotNil(Unmarshal(b, &obj))
}
func Test_read_large_number_as_interface(t *testing.T) {
should := require.New(t)
var val interface{}
err := Config{UseNumber: true}.Froze().UnmarshalFromString(`123456789123456789123456789`, &val)
should.Nil(err)
output, err := MarshalToString(val)
should.Nil(err)
should.Equal(`123456789123456789123456789`, output)
}