Skip to content

Got wrong number when serialize a long number. #12

Open

Description

@FalconIA

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
}

Activity

  1. laktak commented on Feb 8, 2018

    @laktak
    Member

    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");
    
  2. FalconIA commented on Feb 9, 2018

    @FalconIA
    Author

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions