I have json like this:
{
"name": "John",
"address": {
"city": "New York"
}
}
How can I deserialize it to the follow dto using Jackson?
final class PersonDto {
private final String name; // name
private final String city; // address.city
public PersonDto(String name, String city) {
this.name = name;
this.city = city;
}
}
Essentially I am interesting, is it possible to map nested field 'city' in json using just constructor and annotations, or should I write custom deserializer? Thank you.