程式筆記
Golang
Golang Json解析問題 Struct字首大小寫
K
kidneyweakx
April 16, 2020 (Updated: December 17, 2025)
其實這還蠻有趣的,最近在玩golang的爬蟲,高效率的編譯和好用的colly真的還挺好上手的,但是畢竟爬蟲還是要encode成Json才好做跨平台處理。
只是莫名其妙遇到Json print出來都是
code
[]
[]
[]
🤔這是甚麼狀況呢?搞了很久以為是我們Json結構設錯,加了一堆亂七八糟的限制。
結果跑了 Gobyexample的範例 ,意外發現可以跑!
就把他的struct拿過來改,發現首字母都是大寫,原本寫小寫就直接印空白的東西給我們。
這種不報錯的bug最可惡了🤬
Related Articles
→
LOG-DC6
No File is an Island: Unraveling Swift Dependencies and Architecture
> > In the world of Swift, we are accustomed to the power of Xcode and clean syntax. However, as a project's scale grows, an invisible monster begins to haunt the...
[程式筆記][Swift]
@kidneyweakx→
LOG-FE5
Saved by the Logs: How to Recover a Forgotten Keystore Password via IDE Build Logs.
> > The greatest distance in the world is when the password is right in the IDE, but I can't see it
[程式筆記][Android]
@kidneyweakx→
LOG-912
Hexo升級V5排除疑難雜症
> 因為剛好把電腦重灌,然後這個blog就躺在D槽等著我幫他換新的環境,然後他就被我快樂的升級了。
[程式筆記][Javascript][hexo]
@kidneyweakx