When serializing, I would like to serialize an object only once, then any references to that object should be serialized as a reference to the object. This is because, when
You will have to do that by giving the objects identifiers other than their object reference.
An object's reference is essentially it's pointer. Since you cannot manipulate pointers directly in safe code must give the object some other unique name.