# circular-json-es6

> circular JSON.stringify and JSON.parse, for environments with native ES6 Map

Latest version **2.0.2** (published 2018-01-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install circular-json-es6
pnpm add circular-json-es6
yarn add circular-json-es6
bun add circular-json-es6
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2018-01-23 |
| First published | 2016-03-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 130 |
| Author | Evan You |
| Maintainers | yyx990803 |

## Links

- npm: https://www.npmjs.com/package/circular-json-es6
- Repository: https://github.com/yyx990803/circular-json-es6
- Homepage: https://github.com/yyx990803/circular-json-es6#readme
- Issues: https://github.com/yyx990803/circular-json-es6/issues
- npm.io page: https://npm.io/package/circular-json-es6

## Recent versions

- 2.0.2 (latest) — 2018-01-23
- 2.0.1 — 2017-04-19
- 2.0.0 — 2016-03-08
- 1.1.0 — 2016-03-08
- 1.0.0 — 2016-03-04

## README

# circular-json-es6

A replacement for `JSON.stringify` and `JSON.parse` that can handle circular references (persists reference structure).

**This implementation requires environments with native ES6 Map support,** but is decently faster than [circular-json](https://github.com/WebReflection/circular-json) (see benchmark with `npm run bench`).

``` js
var CircularJSON = require('circular-json-es6')

var obj = {}
obj.a = obj

var clone = CircularJSON.parse(CircularJSON.stringify(obj))

clone.a === clone // -> true
```

### NOTE

The default `stringify` method optimizes for cases where no circular reference is present by trying a plain `JSON.stringify` first. This means if no circular references are found in the data then it will not persist multiple (but non-circular) references to the same object.

If you want to enforce reference persistence, use `CircularJSON.stringifyStrict` instead.

---
_Source: https://npm.io/package/circular-json-es6 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
