-
Notifications
You must be signed in to change notification settings - Fork 10
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
Clarify implementation limits on NaN and Infinity #24
Comments
Thanks for the question. If you have questions about how to interpret or implement the JSON5 specification, then you've come to the right place. NaN and Infinity have always been a point of contention for me since I joined this project. I figured an issue like this would come up eventually. It's okay to reject a JSON5 document that contains Alternatively, it would also be okay to just convert the offending JSON5 values to data that your platform can represent, possibly with a warning attached to it. For example, you could convert a large number to infinity, or truncate a large string, or stop nesting objects beyond a certain depth. See the Python and PHP implementations of JSON for examples. While many JSON libraries have extended JSON to support In the end, it's really up to you. I hope that helps. |
Additionally, I think it's best to give developers the option to parse JSON5 documents even if they contain |
Ok. In that case I would suggest to expand this:
into something like:
|
(@jordanbtucker: just want to say you continue to kill it as a maintainer and steward of this project, and I appreciate that very much. Thank you! ❤️) |
I am thinking about adding support for JSON5 in a programming language that doesn't have NaN as a numeric value (operations that would produce it cause an exception instead). Is there any suggestion or experience of others in regards to what should I do in such a case with JSON5 that contains a NaN? Is there a name of a subset that is "JSON5 but not a NaN" that I could refer to so people don't get confused when I reject these values? I'm not sure what's the best course of action here
Sorry if this is not the right place to ask this, I'd be happy to close this and ask somewhere else!
The text was updated successfully, but these errors were encountered: