-
-
Notifications
You must be signed in to change notification settings - Fork 486
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
JsonCompatible serializer is not Json compatible #893
Comments
Thanks for the report. It’s on my todo list. Might be a bit before I get to it. If you need it sooner go ahead and create a pr. You’ll need to handle other data types like double as well. |
Can you point me to the JSON spec you're looking at for positive/negative infinity floats? |
I realize I might have made it up, it seems the real status of Infinity and NaN is unclear: So it could be Null, it could be Undefined, or as someone proposed here https://stackoverflow.com/a/28763430/6230450 it could be the string "Infinity". Either choice is good I suppose as long as the final produced JSON is valid to deserialize. |
Currently using this as a workaround whenever i do any JSON serialization with the YAMLDotNet serializer (in case this helps anyone). I created a stub PR to hopefully make it easier for you to look into it 🙂 hope that helps !! |
This will be fixed in the next release. |
Describe the bug
When serializing an object that contains an infinity float, the YAML DotNet serializer in JsonCompatible mode produces a JSON that contains the keyword
.inf
.According to JSON spec it should write
null
, otherwise i suppose writing a very big number or enclosing.inf
with quotes would be appreciated. Currently the JSON produced by the serializer in that context is unusable for other parsers that expect valid data.To Reproduce
The text was updated successfully, but these errors were encountered: