Suppose I have a Foo structure.
Foo struct { Bar, Baz int }
And I want to combine this structure in json as follows: {bar : 1, baz : 2}
How could I achieve this without breaking a single declaration of several lines ( Bar, Baz int ) into two separate lines using tags.
It works:
Foo struct { Bar int `json:"bar"` Baz int `json:"baz"` }
But I would like to:
Foo struct { Bar, Baz int `json:???` }
Is the last possible?
go
if __name__ is None
source share