Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encoding/json: Unmarshal cannot unmarshal X into Go value of type Y does not tell you the field name #10141

Closed
h4ck3rm1k3 opened this issue Mar 12, 2015 · 2 comments

Comments

@h4ck3rm1k3
Copy link

@h4ck3rm1k3 h4ck3rm1k3 commented Mar 12, 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.

@cespare

This comment has been minimized.

Copy link
Contributor

@cespare cespare commented Mar 12, 2015

Duplicate of #6716

@minux

This comment has been minimized.

Copy link
Member

@minux minux commented Mar 12, 2015

Close as a dup.

@minux minux closed this Mar 12, 2015
@mikioh 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
@golang golang locked and limited conversation to collaborators Jun 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.