1
0
mirror of https://github.com/json-iterator/go.git synced 2025-06-15 22:50:24 +02:00

write map with int key

This commit is contained in:
Tao Wen
2017-06-05 23:01:00 +08:00
parent 5b27aaa62c
commit 29dc1d407d
2 changed files with 50 additions and 2 deletions

View File

@ -66,4 +66,12 @@ func Test_slice_of_map(t *testing.T) {
val = []map[string]string{}
should.Nil(UnmarshalFromString(str, &val))
should.Equal("2", val[0]["1"])
}
func Test_write_int_key_map(t *testing.T) {
should := require.New(t)
val := map[int]string{1: "2"}
str, err := MarshalToString(val)
should.Nil(err)
should.Equal(`{"1":"2"}`, str)
}