How to replace JsonIdentityInfo's id with the full object?

579 Views Asked by At

My question is similar to deserialize Jackson object in JavaScript containing JsonIdentityInfo but I'm working with Java and I'm asking about jackson specifically, not 3rd party stuff.

I'm sending JSON from the server to the client. To save space I'm using @JsonIdentityInfo and the client receives:

[
  {
    "id": 1,
    "nestedObject": {
      "id": 2,
      "someInt": 2,
      "someString": "a"
    }
  },
  {
    "id": 3,
    "nestedObject": 2
  }
]

But the client needs the real/full JSON representation because it's working with parsers which are not JsonIdentityInfo-aware. Does Jackson have a way to "halfway deserialize" the compact representation into the full representation?

[
  {
    "id": 1,
    "nestedObject": {
      "id": 2,
      "someInt": 2,
      "someString": "a"
    }
  },
  {
    "id": 3,
    "nestedObject": {
      "id": 2,
      "someInt": 2,
      "someString": "a"
    }
  }
]
1

There are 1 best solutions below

0
On BEST ANSWER

After doing more research it seems it's impossible to do at this moment, as said in the comments.