You've already forked json-iterator
mirror of
https://github.com/json-iterator/go.git
synced 2025-11-26 22:40:13 +02:00
#68 empty array to object/map
This commit is contained in:
@@ -85,3 +85,17 @@ func Test_float_to_float64(t *testing.T) {
|
||||
should.Nil(jsoniter.UnmarshalFromString(`1.23`, &val))
|
||||
should.Equal(float64(1.23), val)
|
||||
}
|
||||
|
||||
func Test_empty_array_as_map(t *testing.T) {
|
||||
should := require.New(t)
|
||||
var val map[string]interface{}
|
||||
should.Nil(jsoniter.UnmarshalFromString(`[]`, &val))
|
||||
should.Equal(map[string]interface{}{}, val)
|
||||
}
|
||||
|
||||
func Test_empty_array_as_object(t *testing.T) {
|
||||
should := require.New(t)
|
||||
var val struct{}
|
||||
should.Nil(jsoniter.UnmarshalFromString(`[]`, &val))
|
||||
should.Equal(struct{}{}, val)
|
||||
}
|
||||
Reference in New Issue
Block a user