I have a fairly substantial project in typescript that uses a lot of object-oriented programming, resulting in a nontrivial object graph (including some objects indirectly pointing to themselves). I now need to serialize this graph to a string. Is there any way (in typescript) to serialize such a graph without losing information upon de-serialization?
Ideally, I would like a solution with as little mandatory bookkeeping on each new class as possible.
Things I've tried:
JSOG. This didn't work because when it de-serializes the objects, it just leaves them as type Object, and they lose their methods.
TypedJSON. This didn't work because it fails with
Uncaught TypeError: cyclic object value
An unholy combination of the two: This didn't work because even though I can pass something created by jsog-typescript into TypedJSON, TypedJSON will reject it as not being the correct type.