-
Notifications
You must be signed in to change notification settings - Fork 62
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
provide "NaN" and "Infinity" when (de)serializing Java Numbers #209
Comments
Copying a bit of context over from #160, @leadpony made an important comment here: #160 (comment) Which states:
|
Suggestion: Provide 3 states when dealing with Java Numbers: 1. Config with
produces/consumes:
2. Config with
produces/consumes:
3. If both are true
3. If both settings are false To sum up: |
I am implementing this in Parsson. In the point 3 I have a question. When both are true, the logic is split in 2 ways:
The first one Recently a new method was added in JsonValue to manage Numbers here #302 but by default it delegates in existing methods that works primitive types. What is the motivation to make a split between primitive and not primitive types when both are true? |
|
Json-P uses this to (de)serialize Double-values to and from Json:
JsonGenerator write(double value);
Please provide the ability to (de)serialize "NaN", "+Infinity" and "-Infinity" with any type of Numbers (Double, etc) to produce and consume something like this
converter to produce json string:
converter to consume "NaN" and "Infinity" from Json-String:
For example, Json-P could automatically use the
Double
-(de)serializer, ifDouble
-Objects are used. If Json-P detects primitive double-types, thedouble
-(de)serializer can be used.Also, Json-P should provide the Json-P configuration property
NAN_AS_STRINGS
:Actually, Json-P are not able to consume and produce Java Numbers complete: "NaN" and "Infinity" are still valid information about numbers which should not be thrown with exceptions by default.
Related:
The text was updated successfully, but these errors were encountered: