I have the following Go code
type Version struct {
Name string `json: "name"`
Project string `json: "project"`
ProjectId int `json: "projectId"`
}
b := new(bytes.Buffer)
if err := json.NewEncoder(b).Encode(&Version{"foo", "bar", 42}); err != nil {
log.Fatal(err)
return false
}
fmt.Printf("JSON %v", b)
The output is:
{"Name":"foo","Project":"bar","ProjectId": 42}
instead of:
{"name":"foo","project":"bar","projectId": 42}
Any thoughts why?
Thanks