Skip to content

Double parsed with trailing zeros #206

Description

@robbienohra

Some double values trigger trailing zeros when deserialized.

"field": 1.2932 (of type Double)

Is parsed as 1.2932000000000001

If you change the field to type Float then the value is correctly parsed.

Again only certain numbers appear to be triggering this.

You can replicate the issue like this.

Define:

class Obj {

  Double field;

}

Then execute:

String json = "{ \"field\" : 1.2932}";
Obj obj = JsonIterator.deserialize(json,Obj.class);
System.out.println(obj.getField());
//  1.2932000000000001

Same issue arises even if you use the Any api.

Activity

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