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

Got wrong number when serialize a long number. #12

Open
FalconIA opened this issue Jan 26, 2018 · 2 comments
Open

Got wrong number when serialize a long number. #12

FalconIA opened this issue Jan 26, 2018 · 2 comments

Comments

@FalconIA
Copy link

FalconIA commented Jan 26, 2018

Got wrong number when serialize a long number.

Here is a example:

String in = "{ \"id\" : 8093873769532439696 }";
String out = JsonValue.readHjson(in).toString(Stringify.HJSON)

Got

{
  id: 8093873769532439552
}
@laktak
Copy link
Member

laktak commented Feb 8, 2018

8093873769532439696 is too large for the double type.

If you run this in Java you will see a similar result:

double d=Double.parseDouble("8093873769532439696");

@FalconIA
Copy link
Author

FalconIA commented Feb 9, 2018

It's the long type, not the double type.
I do not think that JSON should be limited to double type as javascript.

Actually, Jackson2 can recognize this value correctly.

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

No branches or pull requests

2 participants