1.13.1 • Published 2 months ago

@johfe/perfsee-jsonr v1.13.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 months ago

jsonr

JSON with references

Example

import JSONR from '@johfe/perfsee-jsonr'

const jsonrStr = JSONR.stringify({ hello: "world" })
const obj = JSONR.parse(jsonrStr)

Format

const obj = { a: { hello: 'world', foooobar: 1 }, b: [] as any[] }
obj.b.push(obj.a, obj.a, obj.a)

const jsonrStr = JSONR.stringify(obj)

jsonrStr ->

{
  "a": {
    "hello": "world",
    "foooobar"$0: 1
  },
  "b": [
    {
      "hello"$1: "world"$2,
      $0: 1
    },
    {
      $1:$2,
      $0: 1
    },
    {
      $1:$2,
      $0: 1
    }
  ]
}