-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
Milestone
Description
What steps will reproduce the problem? If possible, include a link to a program on play.golang.org. 1. Create JSON byteslice => jsonBlob := []byte(`{"foo_bar": "baz"}`) 2. Define struct => type Quux struct { FooBar string `json:foo_bar`} 3. Unmarshal into declared Quux => var myQuux Quux err := json.Unmarshal(jsonBlob, &myQuux) fmt.Println(myQuux) What is the expected output? {baz} What do you see instead? { } Which compiler are you using (5g, 6g, 8g, gccgo)? 6g Which operating system are you using? Darwin/OSX Which version are you using? (run 'go version') go version go1.1.1 darwin/amd64 Please provide any additional information below. I expected the struct field's tag value (described here: http://golang.org/pkg/encoding/json/#Marshal) to work in both Marshal and Unmarshal. This would help keep my variable names idiomatic, as well as satisfy external requirements.