How do people typically preserve object references without duplication using kotlinx.serialization?
o
Oliver.O
02/22/2021, 12:37 PM
If you don't mind looking into source code and examples directly, here is a working implementation: https://github.com/OliverO2/graph_serialization
It's lacking a README as it solely serves as an example for a serialization feature request.
💯 1
m
melatonina
02/22/2021, 12:56 PM
Thank you very much, @Oliver.O!
In my case, I already have a representation where the graph references are specified with ids: it's the "database representation" (used with jOOQ) which is then converted in an actual graph of Kotlin objects before my application does anything with them.
I guess I will just serialize the database representation, for now, for network communication purposes.
In the case that won't be enough... yours is a fine example and I'll copy from that.
Thanks again!