serialize and deserialize rich javascript data types, suport reference data.
npm install @rickyli79/rich-json
- NodeJS
- Browser
import RichJson from '@rickyli79/rich-json'
// const RichJson = require('@rickyli79/rich-json');
const complexObj_origin = { key: 'any supported data types' };
const rJson:string = RichJson.stringify(complexObj_origin);
// todo: save rJson to file;
import RichJson from '@rickyli79/rich-json'
const rJson:string = getRichJsonText();
const complexObj = RichJson.parse<TComplaxObj>(rJson);
import RichJson from '@rickyli79/rich-json'
const complexObj_origin = { key: 'any supported data types' };
const complexObj = RichJson.clone(complexObj_origin);
assert.notStrictEqual(complexObj, complexObj_origin);
- primitive
- null
- undefined
- bigint
- number
- normal
NaN
-0
Number.EPSILON
Number.MAX_SAFE_INTEGER
Number.MIN_SAFE_INTEGER
Number.NEGATIVE_INFINITY
Number.POSITIVE_INFINITY
- function
- function
- async function
- arrow function
- async arrow function
- object
URL
Date
RegExp
Set
Map
Error
( withmessage
only,without)stack
- Buffer like
Buffer
in NodeJsInt8Arrany
,Uint16Array
,Uint32Array
...and moreNOT supportBlob
WrapRunner
class- customer serializers
- reference
- reference to same object
- circular reference
including reference in
Set
andMap
, andWrapRunner
class orcustomer serializers