Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
encoding/json: Given struct tags Unmarshal should be strict #14737
When a struct tag is provided the Unmarshal function shouldn't attempt to do a 'best match' against the field name and should instead only accept keys that exactly match the tag. In this case there is a leading valid field but in the case where there isn't one nothing should be parsed out.
This is the documented behavior, and we can't change it
"To unmarshal JSON into a struct, Unmarshal matches incoming object keys to the keys used by Marshal (either the struct field name or its tag), preferring an exact match but also accepting a case-insensitive match."