{"action":"opened","issue":{"url":"https://api.github.com/repos/golang/go/issues/12730","labels_url":"https://api.github.com/repos/golang/go/issues/12730/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/12730/comments","events_url":"https://api.github.com/repos/golang/go/issues/12730/events","html_url":"https://github.com/golang/go/issues/12730","id":108030927,"number":12730,"title":"encoding/json:Unmarshal() doesn't work for struct with lower case field names ","user":{"login":"huangyingyi","id":14813131,"avatar_url":"https://avatars.githubusercontent.com/u/14813131?v=3","gravatar_id":"","url":"https://api.github.com/users/huangyingyi","html_url":"https://github.com/huangyingyi","followers_url":"https://api.github.com/users/huangyingyi/followers","following_url":"https://api.github.com/users/huangyingyi/following{/other_user}","gists_url":"https://api.github.com/users/huangyingyi/gists{/gist_id}","starred_url":"https://api.github.com/users/huangyingyi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huangyingyi/subscriptions","organizations_url":"https://api.github.com/users/huangyingyi/orgs","repos_url":"https://api.github.com/users/huangyingyi/repos","events_url":"https://api.github.com/users/huangyingyi/events{/privacy}","received_events_url":"https://api.github.com/users/huangyingyi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-09-24T00:04:02Z","updated_at":"2015-09-24T00:04:02Z","closed_at":null,"body":"For a struct with a field of integer value, Unmarshal() doesn't put the value in the field. The value is always 0.  Example code:\r\n-------------\r\npackage\tmain\r\nimport (\r\n        \"fmt\"\r\n        \"encoding/json\"\r\n)\r\ntype Animal struct {\r\n\tname  string\r\n\torder int\r\n}\r\nfunc main() {\r\n     var jsonBlob = []byte(`\r\n                  {\"name\": \"Platypus\", \"order\": 10}\r\n                                  `)\r\n                     var one Animal\r\n                     var err = json.Unmarshal(jsonBlob, &one)\r\n\t\t\t\tif err != nil {\r\n                                         fmt.Println(\"error:\", err)\r\n                           }\r\n                     fmt.Printf(\"One:%+v\", one)\r\n}\r\n----------\r\nThe order field is of value 0 which should be 10. If the field name is changed to \"Order\", then it works."}}