simple-safe-stringify

1.0.1 • Public • Published

simple safe stringify

A JSON stringifier that does not fail on circular structures or bigints

Usage

  1. Install the package npm i simple-safe-stringify
  2. Import the module in your project
import { stringifySafe } from "simple-safe-stringify";
  1. Stringify any object
const circularObject = {
    some: {
        levels: {
            deep: null
        }
    }
};
circularObject.some.levels.deep = circularObject.some;

const json = stringifySafe(circularObject);

console.log(json); // '{"some":{"levels":{"deep":"[CIRCULAR #1]"}}}'

Package Sidebar

Install

npm i simple-safe-stringify

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

6.55 kB

Total Files

4

Last publish

Collaborators

  • mahakadema