You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is this line The json package only accesses the exported fields of struct types (those that begin with an uppercase letter). Therefore only the the exported fields of a struct will be present in the JSON output.
It would be great if we could also add an example saying If your json has lowercase keys, then you might have to follow the below snippet to access them. For further information check out https://golang.org/pkg/encoding/json/#Marshal
typeMessagestruct {
Namestring`json:”name” Body string `json:”body”
Timeint64 `json:”time”
}
What did you see instead?
The example stops with the The json package only accesses the exported fields of struct types (those that begin with an uppercase letter). Therefore only the the exported fields of a struct will be present in the JSON output.
This makes it bit difficult for new comers to easily understand the techniques that are very trivial.
I would be happy to submit PR, but I dont know where the docs of blog are.
The text was updated successfully, but these errors were encountered:
What did you expect to see?
Iam from Python background and hence it was little bit difficult for me to understand how unmarshalling works, specially if the keywords are
lowercase
The https://blog.golang.org/json blog appears in the top of the search while searching for json.
There is this line
The json package only accesses the exported fields of struct types (those that begin with an uppercase letter). Therefore only the the exported fields of a struct will be present in the JSON output.
It would be great if we could also add an example saying
If your json has lowercase keys, then you might have to follow the below snippet to access them. For further information check out https://golang.org/pkg/encoding/json/#Marshal
What did you see instead?
The example stops with the
The json package only accesses the exported fields of struct types (those that begin with an uppercase letter). Therefore only the the exported fields of a struct will be present in the JSON output.
This makes it bit difficult for new comers to easily understand the techniques that are very trivial.
I would be happy to submit PR, but I dont know where the docs of blog are.
The text was updated successfully, but these errors were encountered: