Skip to content
Advertisement

Json deserialization Java

i have a simple question, let’s say I have this json

JavaScript

Mapped this way:

JavaScript

I was wondering if it was possible to just save an outer field in the inner object like this by using some custom setter/annotation or something:

JavaScript

PS: using a custom deserialization is my last resort due to the complexity of the json

Advertisement

Answer

If anyone was asking how I solve my problem, I decided to use a custom Builder by using the withXXX methods inside to pass the outer attributes to the inner object during creation

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement