Skip to content

Any plans to support larger than 53-bit integers? #278

Open

Description

@jp-simons

Integers larger than 53 bits are valid JSON, but when parsed by JSON.parse they get truncated down to 53 bits and lose a few least significant digits. We have 64 bit integers coming from our backend and use https://www.npmjs.com/package/json-bigint to parse, any chance of adding an option for replace the built-in JSON.parse with a custom function, or just a boolean option for using json-bigint?

Activity

  1. kjvalencik commented on Nov 16, 2017

    @kjvalencik

    Should just need to provide an option defaulted to JSON.parse. Then you can bring your own JSONBigInt parser.

    parser = opts.parser || JSON.parse;
  2. kjvalencik commented on Nov 20, 2017

    @kjvalencik

    Adding a parser option does make the reviver option redundant since it could be accomplished with:

    {
        parser : body => JSON.parse(body, reviver)
    }
  3. jp-simons commented on Nov 22, 2017

    @jp-simons
    Author

    Right on, thanks!

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