---
title: "Golang Json Parsing Gotcha: Capitalizing Struct Field Names"
description: "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 ea..."
author: "kidneyweakx"
published: 2020-04-16T00:00:00.000Z
updated: 2026-06-02T17:24:36.426Z
lang: en
tags: ["程式筆記", "Golang"]
canonical: https://kidneyweakx.com/blog/20log-0416-gojson?lang=en
alternate_zh_tw: https://kidneyweakx.com/blog/20log-0416-gojson.md
alternate_ja: https://kidneyweakx.com/blog/20log-0416-gojson.md?lang=ja
---

# 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

```
[]
[]
[]
```

🤔 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](https://gobyexample.com/json), 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 🤬
