Go theorytheory 0/50 · 0%
Standard library · easy

18. JSON Encoding

Marshal, Unmarshal and struct tags.

encoding/json maps structs to JSON using exported fields and tags, supporting omitempty and custom names. Decoding into a struct ignores unknown fields unless DisallowUnknownFields is set; json.RawMessage defers parsing of dynamic sections such as RPC results.

Check your understanding

  1. 1. Unexported fields are…

  2. 2. Which tag omits empty values?