【发布时间】:2016-06-20 05:56:21
【问题描述】:
我正在尝试使用改造将 json 解析为 POJO,但不断出现错误。 它似乎得到了数据,据我从 logcat 中看到的,我正确读取并解析了 json。但它返回 succes=false 并且不返回 responsedata 对象。 错误类型和错误消息为 null。 我不知道出了什么问题,如果有任何解决方案或如何定位错误的建议,我将不胜感激。
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;
}
}
}
【问题讨论】:
-
请点击此链接,它应该会有所帮助 - stackoverflow.com/a/33720542/5123494
-
嗨弗拉基米尔,我认为我的问题表达得不好:-(我
标签: java android json retrofit pojo