JSPM

simple-safe-stringify

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q36038F
  • License MIT

A fast, simple, solution to stringifying circular JSON

Package Exports

  • simple-safe-stringify
  • simple-safe-stringify/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (simple-safe-stringify) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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]"}}}'