Unmarshal of JSON Strings
The process to unmarshal JSON Strings in Go are very differently in contrast to JavaScript method “JSON.parse” or generally to non-static languages. There are two methods to do it.
Type assertion (not recommend).
- For not-known json structures.
- Action flexibility.
Structure mapping (recommend)
- for known structures.
- Higher readability
- Higher data consistency.
- Flexibility by member labels “e.g
json:name
(Field appears in JSON as key ‘name’)”. doc
http://starp-germany.de/blog/unmarshal-of-json-strings-in-go/
Written by Dustin
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#