Trying to debug/visualize var using toJSON but it doesn't like methods. Why can't it just skip those?

I am trying to visualize a var so I can better debug and see what’s going on. Is there a method like toJSON except either prints the name of the methods or just ignores them? Really frustrating that I don’t know how to see var contents just because there’s methods in it.

How about a “remove all non-json-compatible methods and objects” function so I can print it?

I believe the issue is memory related, the function is working, but there is an infinite loop of adding the same thing to the output stream over until there’s a crash.

I see the issue. It’s because I have an object that has a child that contains itself, and this is because I need a way to reference the parent.

After removing all the self-references, I am still getting an infinite loop. I guess there’s still one I missed, can’t figure out where it’s getting added. Not sure that’s even the problem now.

FOUND THE F***ING BUGGER FINALLY! One last place in the code it was adding itself to its child. GAD DAMN.