https://github.com/serapath/jsonloop
JSON.{parse, stringify} compatible for circular JSON https://www.npmjs.com/package/jsonloop
https://github.com/serapath/jsonloop
Last synced: about 22 hours ago
JSON representation
JSON.{parse, stringify} compatible for circular JSON https://www.npmjs.com/package/jsonloop
- Host: GitHub
- URL: https://github.com/serapath/jsonloop
- Owner: serapath
- License: mit
- Created: 2020-05-22T00:27:14.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-22T01:07:52.000Z (about 6 years ago)
- Last Synced: 2025-03-16T13:18:38.088Z (over 1 year ago)
- Language: JavaScript
- Homepage: https://serapath.github.io/jsonloop/
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jsonloop
JSON.{parse, stringify} compatible for circular JSON
https://www.npmjs.com/package/jsonloop
https://serapath.github.io/jsonloop/
# use
`npm install jsonloop`
```js
const jsonloop = require('jsonloop')
const defaultSeperator = '.'
const cJSON = jsonloop(defaultSeperator)
var obj2 = { foo: { bar: [{ x: 'y'}, { y: 'x' }], xx: { yy: 'zz' } }, a: 'b' }
obj2.foo.bar.push(obj2.foo.xx)
const json = cJSON.stringify(obj2, 0, 2)
console.log(json) /* {
"foo": {
"bar": [
{
"x": "y"
},
{
"y": "x"
},
{
"yy": "zz"
}
],
"xx": "#.foo.bar.2"
},
"a": "b"
} */
const obj2 = cJSON.parse(json)
console.log(obj2) /*{
"foo": {
"bar": [
{
"x": "y"
},
{
"y": "x"
},
{
"yy": "zz"
}
],
"xx": { yy: "zz" }
},
"a": "b"
} */
```