@rickyli79/rich-json
v1.1.4
Published
Serialize and Deserialize javascript objects
Maintainers
Readme
@rickyli79/rich-json
serialize and deserialize rich javascript data types, suport reference data.
install
npm install @rickyli79/rich-jsonusage
supported runtime
- NodeJS
- Browser
stringify
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;parse
import RichJson from '@rickyli79/rich-json'
const rJson:string = getRichJsonText();
const complexObj = RichJson.parse<TComplaxObj>(rJson);clone
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);supported data types
- primitive
- null
- undefined
- bigint
- number
- normal
NaN-0Number.EPSILONNumber.MAX_SAFE_INTEGERNumber.MIN_SAFE_INTEGERNumber.NEGATIVE_INFINITYNumber.POSITIVE_INFINITY
- function
- function
- async function
- arrow function
- async arrow function
- object
URLDateRegExpSetMapError( withmessageonly, ~~withoutstack~~ )- Buffer like
Bufferin NodeJsInt8Arrany,Uint16Array,Uint32Array...and more- ~~NOT support
Blob~~
WrapRunnerclass- customer serializers
- reference
- reference to same object
- circular reference
including reference in
SetandMap, andWrapRunnerclass orcustomer serializers
unittest
- Report: https://rickyli79.github.io/rich-json/
- unittest files
