Is it possible to map a field which is deeper in a json-response to a property in an object - in other words: transform a json which hierarchy into a flat object?
For example I would like to annotate the 'user_id' property of the Marker class with 'links.user.id'. I have looked into GSON and Jackson, but couldn't find a solution.
Json-Response for a Marker:
{
"id": 791,
"name": "Marker42",
"links": {
"user": {
"href": "http://4242.com/users/970",
"id": 970
}
}
Data-Model:
public class Marker {
@SerializedName("id")
private int id;
@SerializedName("name")
private String name;
@SerializedName("links.user.id")
private int user_id;
}