Unmarshalling to structs in Go - no brainer, eh?
Those days I ran into the same trap the second time. So I decided to have a short writeup for future me and other Go beginners. The trap was that I wrote nice structs like { "key1": "value1", "key2": "value2" } And wanted them to be unmarshalled them into structs like this: type foo struct { key1 string key2 string } Doing this regularly with Jackson in Java I named the attributes like the keys in the JSON file. …