You've already forked json-iterator
mirror of
https://github.com/json-iterator/go.git
synced 2025-12-20 23:30:38 +02:00
make any easier to work with
This commit is contained in:
@@ -15,3 +15,23 @@ func Test_read_map(t *testing.T) {
|
||||
t.Fatal(m)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_read_map_of_interface(t *testing.T) {
|
||||
iter := ParseString(`{"hello": "world"}`)
|
||||
m := map[string]interface{}{"1": "2"}
|
||||
iter.Read(&m)
|
||||
if !reflect.DeepEqual(map[string]interface{}{"1": "2", "hello": "world"}, m) {
|
||||
fmt.Println(iter.Error)
|
||||
t.Fatal(m)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_read_map_of_any(t *testing.T) {
|
||||
iter := ParseString(`{"hello": "world"}`)
|
||||
m := map[string]Any{"1": any("2")}
|
||||
iter.Read(&m)
|
||||
if !reflect.DeepEqual(map[string]Any{"1": any("2"), "hello": any("world")}, m) {
|
||||
fmt.Println(iter.Error)
|
||||
t.Fatal(m)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user