Skip to content
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

feat: Export infinity and NaN values in JSON #889

Merged
merged 1 commit into from
May 5, 2021

Conversation

aababilov
Copy link
Collaborator

@aababilov aababilov commented May 5, 2021

Some notices may have special double values (NaN, Infinity, -Infinity)
in the context. If we do not allow their serialization, then an attempt
to store validation results ends up with a runtime exception.

Documentation for GSON library says the following.

Section 2.4 of JSON specification disallows
special double values (NaN, Infinity, -Infinity). However,
Javascript
specification
(see section 4.3.20, 4.3.22, 4.3.23) allows these values as valid Javascript
values. Moreover, most JavaScript engines will accept these special values in JSON without
problem. So, at a practical level, it makes sense to accept these values as valid JSON even
though JSON specification disallows them.

Some notices may have special double values (NaN, Infinity, -Infinity)
in the context. If we do not allow their serialization, then an attempt
to store validation results ends up with a runtime exception.

Documentation for GSON library says the following.

Section 2.4 of <a href="http://www.ietf.org/rfc/rfc4627.txt">JSON specification</a> disallows
special double values (NaN, Infinity, -Infinity). However,
<a href="http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf">Javascript
specification</a> (see section 4.3.20, 4.3.22, 4.3.23) allows these values as valid Javascript
values. Moreover, most JavaScript engines will accept these special values in JSON without
problem. So, at a practical level, it makes sense to accept these values as valid JSON even
though JSON specification disallows them.
Copy link
Contributor

@lionel-nj lionel-nj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @aababilov that will certainly have a positive impact on #848 where we deserialize the validation reports.

@lionel-nj lionel-nj merged commit 006fe9b into MobilityData:master May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants