I have a rest endpoint that returns a 3 level nested json like this one:
{
"user":{
"departament":{
"departInfo":{
"departName":"String"
}
}
}
}
And I have a java class without the same 3 nested levels:
@JsonIgnorePropertires("ignoreUnknown = true")
class User(){
String departName
}
When I am making a rest call using restTemplate:
User response = restTemplate.exchange(url, HttpMethod.GET,
request, User.class)
jackson is not mapping the field departName (because it is not at the same nested level I guess) even with the json ignore properties.
How can I map this http json response to my java field ignoring the nested parent jsons?