/json

fork of encoding/json that fixes omitempty behavior on structs

Primary LanguageGoBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

json

A fork of encoding/json that fixes omitempty behavior on structs

https://play.golang.org/p/M8AOBJgWMJy

Example

T := struct {
	B struct {} `json:",omitempty"`
}{}

json.NewEncoder(os.Stdout).Encode(T) // stdlib
NewEncoder(os.Stdout).Encode(T) // this package

Output

{"B":{}} // stdlib
{} // this package