npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@bybrave/json-bigint2

v2.0.0

Published

Maintained fork of json-bigint — JSON.parse/stringify with big-number support, native BigInt, TypeScript types

Readme

@bybrave/json-bigint2

CI npm node types license

Maintained fork of json-bigintJSON.parse / JSON.stringify that preserve numbers beyond Number.MAX_SAFE_INTEGER instead of silently corrupting them.

JSON.parse('{"id":9223372036854775807}').id
// 9223372036854775806  ← corrupted

require('@bybrave/json-bigint2')({ useNativeBigInt: true }).parse('{"id":9223372036854775807}').id
// 9223372036854775807n ← exact

Why this fork

The original json-bigint has not been released since 2020, and the code published on npm is older than its master branch — several fixes were merged upstream but never shipped. @bybrave/json-bigint2 is a drop-in replacement that ships the fixed code plus:

| Change | Upstream issue | |---|---| | TypeScript type definitions included | #34 | | Floats no longer crash useNativeBigInt mode (shipped, was unreleased on npm) | #49, #88 | | Numbers beyond the double range (3e+500, 400-digit integers) parse instead of throwing Bad number | #25, #26 | | objectProto option: parsed objects get a normal prototype (hasOwnProperty, toString work) | #39, #64 | | Strict JSON number grammar: 01, -01, 5., 1e are rejected like JSON.parse does | #19 | | Parse errors are real SyntaxError instances (stack trace, instanceof Error) | — | | Zero dev-dependency test suite on node:test, CI on Node 18/20/22 | — |

Install

npm install @bybrave/json-bigint2

Usage

const JSONbig = require('@bybrave/json-bigint2')({ useNativeBigInt: true });

const payload = '{"id":9223372036854775807,"name":"deep"}';
const data = JSONbig.parse(payload);
data.id;                    // 9223372036854775807n
JSONbig.stringify(data);    // '{"id":9223372036854775807,"name":"deep"}'

Without options, unsafe integers become bignumber.js instances (original behaviour):

const JSONbig = require('@bybrave/json-bigint2');
JSONbig.parse('{"id":9223372036854775807}').id.toFixed(); // '9223372036854775807'

TypeScript:

import JSONbig = require('@bybrave/json-bigint2');

const parser = JSONbig({ useNativeBigInt: true, objectProto: true });
const data = parser.parse(payload);

Options

| Option | Default | Description | |---|---|---| | useNativeBigInt | false | Use native BigInt instead of bignumber.js | | alwaysParseAsBig | false | Parse every integer as big, not only unsafe ones | | storeAsString | false | Store big numbers as plain strings | | strict | false | Throw on duplicate object keys | | objectProto | false | Parsed objects get Object.prototype instead of a null prototype | | protoAction | 'error' | "__proto__" key handling: 'error' | 'ignore' | 'preserve' | | constructorAction | 'error' | "constructor" key handling: 'error' | 'ignore' | 'preserve' |

Notes:

  • objectProto: true is safe against prototype pollution: suspicious keys are still guarded by protoAction/constructorAction, and member assignment never touches the actual prototype.
  • In useNativeBigInt mode a number that overflows the double range and keeps a fractional part (e.g. 1.55…5e+309) parses as Infinity, mirroring JSON.parse.

Migrating from json-bigint

It is a drop-in replacement:

- const JSONbig = require('json-bigint')({ useNativeBigInt: true });
+ const JSONbig = require('@bybrave/json-bigint2')({ useNativeBigInt: true });

The only behavioural differences are the bug fixes listed above (strict number grammar may reject inputs that were never valid JSON, and parse errors are now SyntaxError instances).

Support

If this package saves you time, you can support maintenance:

Ko-fi Bitcoin

Bitcoin (BTC): bc1q37557q5jpeaxqydzwvf3jgj7zhnfpn2td3q40q

Credits & license

MIT. Based on json-bigint by Andrey Sidorov, which builds on Douglas Crockford's reference JSON parser.