我想使用改進來解析json到POJO,但不斷收到錯誤。 它似乎得到的數據,據我可以看到從logcat我讀取和正確解析json。但是它返回succes = false並且不返回一個responsedata對象。 錯誤類型和錯誤消息顯示爲空。 我不知道什麼是錯誤的,並會感謝解決方案或如何找到錯誤的任何建議。使用改進解析json到POJO
的Json
{
"competition_info": {
"headline": "competition",
"description": "description for competition.",
"accept_button": "OK",
"open_terms_button": "Open info"
},
"terms": {
"html": "a website in html"
}
}
MyPojo
public class AnnComResponses{
@SerializedName("competition_info")
public CompetitionInfo competitionInfo;
@SerializedName("terms")
public Terms terms;
public class Terms{
@SerializedName("html")
public String html;
public String getTerms() {
return html;
}
}
public class CompetitionInfo{
@SerializedName("headline")
public String headline;
@SerializedName("description")
public String description;
@SerializedName("accept_button")
public String acceptButton;
@SerializedName("open_terms_button")
public String openTermsButton;
public String getHeadline() {
return headline;
}
public String getDescription() {
return description;
}
public String getAcceptButton() {
return acceptButton;
}
public String getOpenTermsButton() {
return openTermsButton;
}
}
}
請點擊此鏈接,它應該幫助 - http://stackoverflow.com/a/33720542/5123494 –
嗨弗拉基米爾 我想我的問題表達不佳:-( 我 – MNielsen