Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
encoding/json: doesn't deserialize json fields with underscores into struct's fields who's tag contains the underscore but the struct field name does not #9841
Given the above json and struct, the value
From the first of three rules listed at http://blog.golang.org/json-and-go:
If I change the struct definition to
Then, after Unmarshalling, e.Some_ID will contain
It appears that when an underscore is involved in the field in the json, tagging the struct's field with an underscore when the struct's field does not contain an underscore will not marshal that field. If the json contains an underscore, so must the struct's field and the tag is useless.