QUEST LOG · April 16, 2020· UPDATED June 2, 2026

Golang Json Parsing Gotcha: Capitalizing Struct Field Names

This one's actually kind of interesting. Lately I've been playing around with web scraping in Golang. The fast compilation and the handy colly make it really easy to pick up, but at the end of the day a scraper still needs to encode to Json to make cross-platform handling easy.

Except, out of nowhere, everything Json Print() gave me was

code
[]
[]
[]

🤔 What's going on here? I spent ages thinking we'd defined the Json structure wrong and piled on all sorts of random constraints.
Then I ran the Gobyexample example ↗, and to my surprise, it worked!

So I took its struct and adapted it, and noticed the first letters were all uppercase. Ours were lowercase, so it just printed blanks at us.
Bugs that don't throw errors are the absolute worst 🤬

Apps I ship

Free on iOS and Android.

Solid(ar)ity

Solid(ar)ity

A privacy-first identity wallet: zero-knowledge proofs and signed cards swapped face to face, no central server.