I'm parsing wikipedia API data, but don't get how to deal with changing serialized name on every new search request. It's always the first item of "pages" array (1156934). I am making request using Q204873 wiki data code to get page title, for example "Ammonium carbonate". But I don't know wikipedia pageID (1156934) before request.
My gson model with marked problem (1156934 would fit here, but it changes as I make request with different wikidata Q code during new search query):
public class WikiPageList {
@SerializedName("WikiPage") //PROBLEM
private WikiPage wikiPage;
public void setWikiPage(WikiPage wikiPage){
this.wikiPage = wikiPage;
}
public WikiPage getWikiPage(){
return wikiPage;
}
@Override
public String toString(){
return
"WikiPageList{" +
"WikiPage = '" + wikiPage + '\'' +
"}";
}
}
How can I only deserialize first item of pages array? I can also supply multiple Q codes to receive multiple titles, but how to use same gson model for every array item?