-
Notifications
You must be signed in to change notification settings - Fork 18k
encoding/json: nested unmarshaling mangles errors #68750
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
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Comments
cc @rsc |
We should join |
Change https://go.dev/cl/605455 mentions this issue: |
j2gg0s
added a commit
to j2gg0s/go
that referenced
this issue
Aug 14, 2024
When people return UnmarshalTypeError in UnmarshalJSON, we should append error's Field to FieldStack. Fixes golang#68750
j2gg0s
added a commit
to j2gg0s/go
that referenced
this issue
Aug 15, 2024
When people return UnmarshalTypeError in UnmarshalJSON, we should append error's Field to FieldStack. Fixes golang#68750
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Go version
go version devel go1.24-96f7159705 Tue Jul 30 20:12:39 2024 +0000 linux/amd64
Output of
go env
in your module/workspace:What did you do?
https://play.golang.org/p/Ypv2xaFDAOs
What did you see happen?
json: cannot unmarshal string into Go struct field .k of type int
json: cannot unmarshal string into Go struct field Foo.Bar of type int
What did you expect to see?
A less misleading error returned by the call to
json.Unmarshal
inmain
. The type ofFoo.Bar
is notint
and we no longer know where the error actually happened.The text was updated successfully, but these errors were encountered: