-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: include field name in unmarshal error messages #6716
Comments
Agree this would be nice. Made slightly inconvenient to implement because by the time the error is generated the decoder is looking at the field value itself, not the struct that contains the field. The relevant code doesn't even know that it's decoding into a struct field. There are a few ways to get around this but they are non-trivial. Labels changed: added priority-later, removed priority-triage. Status changed to Accepted. |
I have a patch for at least on level of code in #10134 would really want to store the entire stack and report on it. Could just append to the key string and make it longer each time when recursion happens. |
CL https://golang.org/cl/18692 mentions this issue. |
Fixing this is fine as long as the additional tracking does not slow down the common case (for example, the additional tracking can't allocate extra data for successful parses). The CL needs to be reviewed with that in mind, and possibly updated. |
And what about time.Time in structure field? https://play.golang.org/p/YnlDi-3DMP I got |
@ganelon13 Commenting on closed issues often doesn't get a response. Times in JSON should be in RFC3339 format. |
@nathany Yes, I know this, thank you. But I want the field name in the error message |
@ganelon13 Oh, now I understand. Good call. I would suggest opening a new issue specifically for that with a reference to this issue #6716. verified it's still an issue on master:
|
I was complaining about this error message: However, this turns out to probably be a bug in the go-protoc generated code for protobufs, rather than go json itself. |
by hitesh.jasani:
The text was updated successfully, but these errors were encountered: