JohnWeisz / TypedJSON

Typed JSON parsing and serializing for TypeScript that preserves type information.
MIT License
604 stars 64 forks source link

object references not preserved #1

Open JohnWeisz opened 8 years ago

JohnWeisz commented 8 years ago

Currently, serializing then deserializing an object where multiple properties reference the same object will yield separate objects:

@JsonObject
class Person { }

@JsonObject
class Company {
    @JsonMember boss: Person;
    @JsonMember owner: Person;
}

var company = new Company();
company.boss = company.owner = new Person();
var ripoff = TypedJSON.parse(TypedJSON.stringify(company), Company);

ripoff.boss === ripoff.owner; // false

This feature is planned to be supported in the future.

puchm commented 1 year ago

Are there any updates on this?