JSON cyclic structure

Several times, you might have ended up with the Javascript error “TypeError: JSON.stringify cannot serialize cyclic structures” and you must be wondered what is  JSON cyclic structure?

Here is an example for JSON cyclic structure .

var foo = {};
foo.bar = foo;

You created an object foo.

Then you assigned the same object foo to a property of foo to create JSON cyclic structure.

Leave a Reply

Your email address will not be published. Required fields are marked *