go json.Unmarshal 不工作

go json.Unmarshal do not working

我有 json 未解码为结构。

我知道我的代码中某处有错误,但我卡住了,不知道错误在哪里以及我做错了什么

请帮助我,这是我的代码:

type GOOGLE_JSON struct {
    code        string `json:"code"`
    clientId    string `json:"clientId"`
    redirectUri string `json:"redirectUri"`
}

body := []byte(`{"code":"111","clientId":"222","redirectUri":"333"}`)

//google_json := GOOGLE_JSON{}
var google_json GOOGLE_JSON

err := json.Unmarshal(body, &google_json)
if err != nil {
    fmt.Println(err)
}
fmt.Println(google_json)

example here

我发现错误

    type GOOGLE_JSON struct {
        code        string `json:"code"`
        clientId    string `json:"clientId"`
        redirectUri string `json:"redirectUri"`
    }

必须是大写字母

    type GOOGLE_JSON struct {
        Code        string `json:"code"`
        ClientId    string `json:"clientId"`
        RedirectUri string `json:"redirectUri"`
    }

我没注意

Code // <- exported
ClientId // <- exported
RedirectUri // <- exported

code // <-- not exported
clientId // <-- not exported
redirectUri // <-- not exported