1
0
mirror of https://github.com/json-iterator/go.git synced 2025-06-12 22:47:42 +02:00

Fixes #405 - Encode nil map into null

This commit is contained in:
Ben Brooks
2019-09-19 13:11:30 +01:00
parent 27518f6661
commit 028e2ef2bd
2 changed files with 12 additions and 0 deletions

View File

@ -42,3 +42,11 @@ func Test_map_eface_of_eface(t *testing.T) {
should.NoError(err)
should.Equal(`{"1":2,"3":"4"}`, output)
}
func Test_encode_nil_map(t *testing.T) {
should := require.New(t)
var nilMap map[string]string
output, err := jsoniter.MarshalToString(nilMap)
should.NoError(err)
should.Equal(`null`, output)
}