Stringify Circular Structures in JavaScript
Code snippet:
Copied Stringify Code
Note:
This function omits the keys in the result that have circular reference.
This function will ignore the duplicate nodes having circular reference in the result.
If you want to include the keys having circular reference (or) the duplicate nodes with circular reference, then use as below:
JSONUtils.getJSON(<object_to_be_stringified>, true);
The result of passing the second argument to the function as true, is that the keys will be preserved with value as [!#CircularReference#!]