You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Type of Age in go struct is string, it will return {Name: "John", Age: "", Gen: "M"} and error message.
Output:
json: cannot unmarshal number into Go struct field person.age of type string
JohnM
What did you see instead?
In raw json, "gen" field shows after "age", it seems wasn't touched by decoder.
Output:
json: cannot unmarshal number into Go struct field person.age of type string
John
The text was updated successfully, but these errors were encountered:
What version of Go are you using (
go version
)?1.7.3 and 1.8
What operating system and processor architecture are you using (
go env
)?amd64 linux
What did you do?
Go Playground link
What did you expect to see?
Type of Age in go struct is string, it will return {Name: "John", Age: "", Gen: "M"} and error message.
Output:
json: cannot unmarshal number into Go struct field person.age of type string
JohnM
What did you see instead?
In raw json, "gen" field shows after "age", it seems wasn't touched by decoder.
Output:
json: cannot unmarshal number into Go struct field person.age of type string
John
The text was updated successfully, but these errors were encountered: