When un-marshaling, go json decode does not report the context ( field name or path to the element) that has a type error. On large files this can be a problem. If you have nested objects it might be harder to find so ideally a stack of keys that form a path would be described if possible.
mikioh
changed the title
encoding json.Unmarshal cannot unmarshal X into Go value of type Y does not tell you the field name
encoding/json: Unmarshal cannot unmarshal X into Go value of type Y does not tell you the field name
Mar 13, 2015
When un-marshaling, go json decode does not report the context ( field name or path to the element) that has a type error. On large files this can be a problem. If you have nested objects it might be harder to find so ideally a stack of keys that form a path would be described if possible.
See stack overflow questions
http://stackoverflow.com/questions/24325210/get-field-name-that-errs-in-go-json-unmarshal
http://stackoverflow.com/questions/21151765/json-cannot-unmarshal-string-into-go-value-of-type-int64
http://stackoverflow.com/questions/23582744/go-get-a-broken-json-field-name
Originally described in #10134 I have a possible solution there.
The text was updated successfully, but these errors were encountered: