post-robot icon indicating copy to clipboard operation
post-robot copied to clipboard

Serializing circular objects and toJSON

Open doublemarked opened this issue 5 years ago • 2 comments

I'm using post-robot via zoid, passing an object back to my parent via a callback function. This object contains a circular reference deep within it, but I've implemented a toJSON() method on the class containing the reference in order to support serialization.

This object can be happily serialized with JSON.stringify(), but it breaks when post-robot serializes it. I believe post-robot isn't calling my toJSON() method, it's walking the object itself and follows the circular reference to its doom.

Please advise?

doublemarked avatar Mar 13 '19 09:03 doublemarked

Hey @bluepnume any thoughts on this issue? Maybe you can advise on a fix? I can probably find time to work on a PR

doublemarked avatar Sep 11 '19 10:09 doublemarked

+1

ddenev avatar Jan 07 '20 09:01 ddenev