Skip to content

Floating-point NaN or Infinity values should be allowed as a feature #209

Closed
@Dani-Hub

Description

@Dani-Hub

The JSON specification doesn't support special floating values such as any NaN value or +/-infinity. But many (if not most) Json libraries at least provide a special Flag to allow them. As an example see the flag serializeSpecialFloatingPointValues of the google-Gson library:

http://google-gson.googlecode.com/svn-history/trunk/gson/docs/javadocs/com/google/gson/GsonBuilder.html#serializeSpecialFloatingPointValues%28%29

It seems that the choice of representation chosen here (NaN for a NaN, Infinity and -Infinity for positive/negative infinity is quite popular and I recommend to use them when this feature is active.

Other JSON library with similar support:

https://github.com/aseemk/json5
https://simplejson.readthedocs.org/en/latest/

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions