|
|
@ -14,13 +14,13 @@ features which the standard json package cannot offer. |
|
|
|
Struct Tags |
|
|
|
Struct Tags |
|
|
|
|
|
|
|
|
|
|
|
All fields are required unless the "optional" struct tag is present. The generated |
|
|
|
All fields are required unless the "optional" struct tag is present. The generated |
|
|
|
unmarshaling method return an error if a required field is missing. Other struct tags are |
|
|
|
unmarshaling method returns an error if a required field is missing. Other struct tags are |
|
|
|
carried over as is. The standard "json" and "yaml" tags can be used to rename a field when |
|
|
|
carried over as is. The standard "json" and "yaml" tags can be used to rename a field when |
|
|
|
marshaling to/from JSON. |
|
|
|
marshaling. |
|
|
|
|
|
|
|
|
|
|
|
Example: |
|
|
|
Example: |
|
|
|
|
|
|
|
|
|
|
|
type foo { |
|
|
|
type foo struct { |
|
|
|
Required string |
|
|
|
Required string |
|
|
|
Optional string `optional:""` |
|
|
|
Optional string `optional:""` |
|
|
|
Renamed string `json:"otherName"` |
|
|
|
Renamed string `json:"otherName"` |
|
|
|