Is it possible to deserialize a JSON in typescript that contains references to objects already existing within it?
For instance, consider a scenario where there is a grandparent "Papa" connected to two parents "Dad" and "Mom", who have two children together. The JSON structure looks like this:
{
"id_": 1,
"name": "Papa",
"parents": [
{
"@class": "com.doubleip.spot.mgmt.test.domain.model.Parent",
"id_": 1,
"name": "Dad",
"children": [
{
"@class": "com.doubleip.spot.mgmt.test.domain.model.Child",
"id_": 1,
"name": "Bob"
},
{
"@class": "com.doubleip.spot.mgmt.test.domain.model.Child",
"id_": 2,
"name": "Trudy"
}
]
},
{
"@class": "com.doubleip.spot.mgmt.test.domain.model.Parent",
"id_": 2,
"name": "Mom",
"children": [
1,
2
]
}
]
}
The issue arises during front-end deserialization using TypeScript, Angular, and PrimeNG components due to the JsonIdentityInfo feature utilized in Java with fasterxml library.