encoding/json: Unmarshal does not handle structs with lowercase fields #8598
What does 'go version' print? 1.3 What steps reproduce the problem? If possible, include a link to a program on play.golang.org. 1. Run this: http://play.golang.org/p/EXzXy8Ec01 What happened? There is no error and the struct has no fields set What should have happened instead? The name field should have been set to foo. Please provide any additional information below. Apparently Unmarshal silently ignores field names that are lowercase. If I change the 'name' field in the struct to 'Name', then it works. This is especially painful as examples in effective go (e.g. https://golang.org/doc/effective_go.html#formatting) show structs with lowercase fields. Ideally, Unmarshal would handle structs with lowercase fields. If that isn't practical for some reason, the docs should mention it, and perhaps Unmarshal should return an error if passed a struct type which has no fields that are settable.
The text was updated successfully, but these errors were encountered:
This issue was closed.