Proposal: encoding/json: add new tag for numbers to be string or number literals for unmarshalling #19175
Labels
Comments
You can already handle this by implementing the |
Closing since solutions already exist, and the json package is increasingly frozen for changes. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Current implementation of json decoder (1.7) requires numbers be integers or strings only if string tag specified. Most web oriented languages (php for example) has no difference between types, so json produced by them can contain integers/floats/booleans as strings.
I suggest to create new tag which permits numbers as strings and ints at same time.
Example:
Can be unmarshalled from
{"x":"1234"}
and{"x":1234}
The text was updated successfully, but these errors were encountered: