Hi Guys
You will see this error on converting a json to string using JSON.stringify .
Full stacktrace is like
Below is the sample code that can cause this exception. You can see that we have created an element object in line number 1 and in line number 2 we are assigning the same element object to the node attribute of the element.
This is having a circular reference . Hence you will experience the exception.
Uncaught TypeError: Converting circular structure to JSON
at JSON.stringify (<anonymous>)
at <anonymous>:1:6
at JSON.stringify (<anonymous>)
at <anonymous>:1:6
var element={"node":{}};
element.node=element;
element.node=element;
JSON.stringify(element);
var element={"node":{}};
element.node=element;
element.node=element;
angular.toJson(element);
new TypeError("Converting circular structure to JSON");