Closed
Description
- What version of Go are you using (
go version
)?
go1.6 linux/amd64 - What operating system and processor architecture are you using (
go env
)?
linux/amd64 - What did you do?
(Use play.golang.org to provide a runnable example, if possible.)
http://play.golang.org/p/8QZq-0vRch - What did you expect to see?
Unmarshal did not accept a invalid JSON as a json.Number, instead, it should raise an error - What did you see instead?
Unmarshal accepted a invalid JSON as a json.Number and did not raise an error
encoding/json: Encode results in invalid json if json.Number is not a valid number #10281 is the one that actually fixed this issue, however, shouldn't unmarshal should also raise an error? Right now only Marshalling is an raising a error.
@edit
I actually did some further testing and it only happens when Unmarshalling into a struct field, as can be seen in the updated snippet above.
@edit2
It also happens when using map[string]json.Number and I have updated the test case accordingly.