去json.Unmarshal不工作

qwe*_*max 3 json go unmarshalling

我有json未解码为struct.

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

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

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)
Run Code Online (Sandbox Code Playgroud)

这里的例子

qwe*_*max 10

我发现了错误

    type GOOGLE_JSON struct {
        code        string `json:"code"`
        clientId    string `json:"clientId"`
        redirectUri string `json:"redirectUri"`
    }
Run Code Online (Sandbox Code Playgroud)

必须是大写字母

    type GOOGLE_JSON struct {
        Code        string `json:"code"`
        ClientId    string `json:"clientId"`
        RedirectUri string `json:"redirectUri"`
    }
Run Code Online (Sandbox Code Playgroud)

我不专心

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

code // <-- not exported
clientId // <-- not exported
redirectUri // <-- not exported
Run Code Online (Sandbox Code Playgroud)