circ-json
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Circ json

Json (readable) inspired serializer for cyclic objects.

Installation

 $ npm i circ-json

Usage

Analog to JSON

import { stringify, parse } from "circ-json"

const c = {
  a: 1,
  b: {i: 1}
}

c.c = c
c.bb = c.b

const s = stringify(c) //{"a":1,"b":{"i":1},"c":{"$ref":"#"},"bb":{"$ref":"#/b"}}

deepEqual(parse(s), c) // true

Contribute

All feedback is appreciated. Create a pull request or write an issue.

Package Sidebar

Install

npm i circ-json

Weekly Downloads

2,624

Version

1.0.4

License

ISC

Unpacked Size

15 kB

Total Files

10

Last publish

Collaborators

  • zzrv