Configuring serialization and deserialization with relationships