Skip to content

JSON field tag options are sensitive to whitespace #18531

Closed
@exhaze

Description

@exhaze

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

1.7.4

What operating system and processor architecture are you using (go env)?

darwin/amd64

What did you do?

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

What did you expect to see?

type A struct { B *int `json:"b, omitempty"` } should serialize to {}

What did you see instead?

type A struct { B *int `json:"b, omitempty"` } serializes to {"b":null}

Happy to submit a patch to address this, just wanted to know if there wasn't a specific unstated reason why this is the way it is.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions