Skip to content

Latest commit

 

History

History
20 lines (16 loc) · 333 Bytes

File metadata and controls

20 lines (16 loc) · 333 Bytes

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