Added warning for capital field names in structs
Names without capital letters will be ignored by the JSON Marshaller. This may cause confusion when fields are not being unmarshalled correctly without a warning why.
This commit is contained in:
parent
ec54a84b0c
commit
f1a6a94afd
@ -14,6 +14,8 @@ type response1 struct {
|
||||
Page int
|
||||
Fruits []string
|
||||
}
|
||||
// Fields must have capital letters to be exposed to other
|
||||
// programs such as the JSON Marshaller.
|
||||
type response2 struct {
|
||||
Page int `json:"page"`
|
||||
Fruits []string `json:"fruits"`
|
||||
|
Loading…
x
Reference in New Issue
Block a user