Serialization library with support for circular references?

Andrej Mitrovic andrej.mitrovich at gmail.com
Sat Nov 10 04:42:14 PST 2012


I've been using msgpack for a while, unfortunately I've just
discovered it doesn't support serializing circular references
(http://jira.msgpack.org/browse/MSGPACK-81), e.g.:

import msgpack;

class Foo
{
    int x;
    Bar obj;
}

class Bar
{
    int x;
    Foo obj;
}

void main()
{
    auto foo = new Foo();
    auto bar = new Bar();
    foo.obj = bar;
    bar.obj = foo;
    ubyte[] data = msgpack.pack(foo);
}

Orange doesn't work with circular references either. Is there any
other serialization library that supports this scenario? I'm looking
for something fast, and binary format is ok, I don't need a
user-readable format.


More information about the Digitalmars-d-learn mailing list