posts
Go JSON Unmarshaling
2026, Feb 26
| 3 min read
|
Chris Zietlow
Chris ZietlowRecovering Software Engineer, Philomath, Shitty Photographer, Technologist, believes the oxford comma isn't optional.
TL;DR When working with an API that returned json with inconsistent types, json.Unmarshal would fail because it was mapped to a matching Go type via tags in the struct. The solution was to create a new type to support any permutation of data the API might return, and have that type implement Unmarshaler or …
Read More