Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

json.cycle

Usage

Library enables stringifying cyclic structures such as:

const a = { property1: 'value' };
a.property2 = a;

JSON.stringify(a);

..which would normally throw exception Uncaught TypeError: Converting circular structure to JSON.

To encode circular structure with conversion of cyclic elements to JSON.path do:

import '../src/json-encode-cycles';

(...)

const output = JSON.encodeCycles(a);

See tests for more details

Tests

Run npm test

About

JSON stringify cyclic structures

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages