Skip to content

Parsing a long value leads to different value as double #1065

@dstrasse

Description

@dstrasse

Hi,
my REST response contains something like

"myId":7000000000000125407
The JSON is a little bit more complex so a Map is used as the basic data type.
Unfortunately, the value for my given ID will be a different one after parsing since Gson casts to double directly which leads to the following value in my map:

(double)7000000000000125407l -> 7.0000000000001249E18

Unfortunately, the JSON is supplied by a 3rd party system and cannot be modified, so I cannot add quotes. A way to enforce Strings for defined types would be great.

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