simple-safe-stringify
v1.0.1
Published
A fast, simple, solution to stringifying circular JSON
Downloads
2
Maintainers
Readme
simple safe stringify
A JSON stringifier that does not fail on circular structures or bigints
Usage
- Install the package
npm i simple-safe-stringify
- Import the module in your project
import { stringifySafe } from "simple-safe-stringify";
- 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]"}}}'