I have the json:
{
"albums": [
{
"default": {
"privacy": "public"
......
}
}
},
{
"second_album": {
"privacy": "public"
......
}
},
{
"third_album": {
"privacy": "public"
......
}
}
}
]
}
I want to make Java Objects for this json.
public class AlbumsResponse {
private List<Album> albums = new ArrayList<>();
public List<Album> getAlbums() {
return albums;
}
public void setAlbums(List<Album> albums) {
this.albums = albums;
}
}
and
public class Album {
private Title title;
public Title getTitle() {
return title;
}
public void setTitle(Title title) {
this.title = title;
}
}
But as you can see Album has no any "Title" field in json but has something like this
"second_album": {
"privacy": "public"
......
}
How to work with this? How to convert name of json-object as unit in json-array to field "title" in java-object?