referential-json-stringify
Provides stringify
/parse
functions for converting objects with shared/circular references to/from JSON
How to Use
Browser
- Download ./dist/referential-json-stringify.min.js and add it to your project's files
- Add
<script src='referential-json-stringify.min.js'></script>
to your page's<head>
- call
referentialJsonStringify.stringify
andreferentialJsonStringify.parse
as needed
Node
npm install referential-json-stringify
import { stringify, parse } from 'referential-json-stringify';
- call as needed
Example
; const a = name: 'a';aa = a;const b = name: 'b' a;const root = name: 'root' a b; ;// [// "root",// {// "name":2,// "a":1// },// "a",// {// "name":4,// "a":1// },// "b",// {// "name":0,// "a":1,// "b":3// }// ]