What does this notation mean when we declare some name
next to the field?
type Poet struct {
PS string `name:"testString"`
}
How to use it?
What does this notation mean when we declare some name
next to the field?
type Poet struct {
PS string `name:"testString"`
}
How to use it?
This is for example used to declare how the elements of a JSON object map to the struct members.
Example:
json:"key"
you send key as key
or
json:"KeY"
you send key as KeY
or
json:"KeY,omitempty"
you send key as KeY, but is the value empty, it is not considered.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.