json-iterator / go

A high-performance 100% compatible drop-in replacement of "encoding/json"
http://jsoniter.com/migrate-from-go-std.html
MIT License
13.33k stars 1.02k forks source link

Add EmptyCollections config option for maps and slices #656

Open emcfarlane opened 1 year ago

emcfarlane commented 1 year ago

Adds a config option EmptyCollections to encode nil maps and slices as empty collections.

Based on the issue described in more detail here: https://github.com/golang/go/issues/27589 but works with a configuration option.