Serializing object that contains cyclic object value
I have an object (parse tree) that contains child nodes which are references to other nodes. I'd like to serialize this object, using JSON.stringify() , but I get : TypeError: cyclic object value because of the constructs I mentioned. How could I work around this? It does not matter to me whether these references to other nodes are represented or not in the serialized object. On the other hand, removing these properties from the object when they are being created seems tedious and I wouldn't want to make changes to the parser (narcissus). Use the second parameter of stringify , the replacer