Skip to content

Double / Long deserialize #1679

Description

@yuvalp-k2view

Sometimes it is useful to parse '5' as long vs '5.0' as double, especially when parsing arbitrary data.

This would make the serialize/deserialize of numbers symetric (5.0 > "5.0" > 5.0, 5L > "5" > 5L)

I'd like to suggest a new builder param:
setNumberDererializationPolicy()
default will remain as is
however, user will be able to specify:
setNumberDererializationPolicy(NumberDererializationPolicy.LONG_SUPPORT)

I think this presents a good compromise between the spec being strictly double and the reality where double has precision issues and users need a way to store longs in arbitrary json.

We'd be happy to create a PR if this is acceptable

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