encoding/json: custom type unmarshaling #47078
Labels
FeatureRequest
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What did you do?
I have a slightly non-spec json input to parse:
I tried unmarshaling to json.RawMessage, but can't go past json.Unmarshal. The error was thrown by the checkValid func.
What did you expect to see?
This is similar to issue #3480. But since NaN is not quoted, the parser dismiss it as invalid json and never get to the custom UnmarshalJSON.
What did you see instead?
Error saying cannot parse at 'N'.
This limitation also apply to things like Inf, 0x1234, etc. It would be great if there is an option to relax validation so that it can tolerate unquoted values, with the understanding that these values will be handled by custom unmarshalers. Obviously, the parser should return error if such values contain reserved chars like , : {} [].
The text was updated successfully, but these errors were encountered: