-
Notifications
You must be signed in to change notification settings - Fork 102
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
RFC: Add allownan
keyword argument to parse() (Fixes #168)
#280
Conversation
allownan
keyword argument to parse()allownan
keyword argument to parse() (Fixes #168)
There are no tests yet. I'll wait for any discussion on whether or not this is desired first. |
Seems okay to me in principle but I'm not all that familiar with the JSON spec nor the internals of this package so I'm probably not the best person to review this. |
I think that if we have a permissive mode like this we should also support the Python output nan, inf, -inf (note case). I'm not sure if any Python code generates this output though. |
According to the Python
simplejson and rapidjson follow the same convention. Google's JavaScript GSON module also accepts Given this, I don't think we need to support standard Python values in JSON. |
While looking through some of the packages in the previous comment, I ran across this snippet (from https://tools.ietf.org/html/rfc7159.html#section-9):
Given this, I think what we're doing here is not too unreasonable. That said
|
I'll add tests, and see if anyone else wants to review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM pending tests.
allownan
keyword argument to parse() (Fixes #168)allownan
keyword argument to parse() (Fixes #168)
The codecov results are a bit hard to understand--it looks like we're not providing the right line numbers, and/or some of the code that was added was simply inlined later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
Okay, thanks @TotalVerb. Merging! (Edit: after squashing and running CI to make sure I didn't screw up the squash...) |
* Allows reading out-of-spec JSON files which include Nan, Infinity, and -Infinity
Unfortunately this was never updated in JuliaIO#280 to be the correct default, and so has been wrong ever since introduction.
Nan
,Infinity
, and-Infinity
The ideal solution to reading out-of-spec JSON files was proposed by @TotalVerb in #169.
Until that is implemented, this provides a pragmatic solution for people to read these types of JSON files when they don't have control over the file generation.