Deviopath › Go

JSON User

Medium · Encoding

encoding/json uses struct tags: `json:"name". json.Marshal turns a value into bytes. json.Unmarshal` fills a struct from bytes. Unknown JSON fields are ignored.

Write ParseUser(raw) that unmarshals {"name":"...","age":N} into a User and returns the name and age. Invalid JSON returns ("", 0).

Next: Sort People