Last Updated: February 25, 2016
·
593
· becreative-germany

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/