У меня есть объект JSON, который выглядит следующим образом:
{
"SearchResponse":{
"Version":"2.2",
"Query":{
"SearchTerms":"codexperiments"
},
"Web":{
"Total":41,
"Offset":0,
"Results":[
{
"Title":"Code Xperiments - Because IT is an experimental science",
"Description":"The deferred-time page scrolling technique I described in my previous article is not what I really wanted to achieve at first. Although powerful, it lacks of “dynamism”.",
"Url":"http:\/\/www.codexperiments.com\/",
"CacheUrl":"http:\/\/cc.bingj.com\/cache.aspx?q=codexperiments&d=4548825798150827&mkt=en-US&w=a8960869,c9182d07",
"DisplayUrl":"www.codexperiments.com",
"DateTime":"2011-01-14T16:19:00Z"
}
]
}
}
}
Я пытаюсь разобрать заголовок / URL, используя gson
public class GoogleResults {
private ResponseData responseData;
public ResponseData getResponseData() { return responseData; }
public void setResponseData(ResponseData responseData) { this.responseData = responseData; }
public String toString() { return "ResponseData[" + responseData + "]"; }
static class ResponseData {
private List<Result> results;
public List<Result> getResults() { return results; }
public void setResults(List<Result> results) { this.results = results; }
public String toString() { return "Results[" + results + "]"; }
}
static class Result {
private String url;
private String title;
public String getUrl() { return url; }
public String getTitle() { return title; }
public void setUrl(String url) { this.url = url; }
public void setTitle(String title) { this.title = title; }
public String toString() { return "Results[url:" + url +",title:" + title + "]"; }
}
}
и
GoogleResults results = new Gson().fromJson(reader, GoogleResults.class);
но мои результаты всегда нулевые. Есть идеи, что мне не хватает ??