1.1.5 • Published 4 years ago

bigint-json v1.1.5

Weekly downloads
28
License
MIT
Repository
github
Last release
4 years ago

bigint-json

GitHub issues GitHub license

Simple package that allows you to use JSON.parse & JSON.stringify with BigInt support.

It works by converting bigints to string and appending n when stringifying and finding strings representing numbers ending with n and converting then to BigInt when parsing

Install

$ npm install bigint-json

Usage

const bigintJSON = require('bigint-json');

const someObject = {someKey: 1234n};

const json = bigintJSON.stringify(someObject); // '{"someKey":"1234n"}'

const parsed = bigintJSON.parse(json); // { someKey: 1234n }

Works with nested objects as well

It uses Douglas Crockford JSON.js package

1.1.5

4 years ago

1.1.4

4 years ago

1.1.1

4 years ago

1.1.2

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago