用Gson解析数据是出错
com.google.gson.JsonSyntaxException:java.lang.IllegalStateException:ExpectedBEGIN_OBJ...
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1这是报的错误
这是我写的bean类
public class NewsJsonToBean {
public String errNum;
public GetNews retData;
private String errMsg;
public String getErrMsg() {
return errMsg;
}
public String getErrNum() {
return errNum;
}
public GetNews getRetData() {
return retData;
}
/**
* 返回的新闻以及是否还有更多新闻
*/
public class GetNews {
public String has_more;
public ArrayList<NewsDetail> data;
public String getHas_more() {
return has_more;
}
public ArrayList<NewsDetail> getData() {
return data;
}
/**
* 新闻返回的详细数据
*/
public class NewsDetail {
@SerializedName("abstract")
public String mabstract;
public String img_url;
@SerializedName("title")
public String mtitle;
public String url;
public String getMabstract() {
return mabstract;
}
public String getImg_url() {
return img_url;
}
public String getMtitle() {
return mtitle;
}
public String getUrl() {
return url;
}
}
}
} 展开
这是我写的bean类
public class NewsJsonToBean {
public String errNum;
public GetNews retData;
private String errMsg;
public String getErrMsg() {
return errMsg;
}
public String getErrNum() {
return errNum;
}
public GetNews getRetData() {
return retData;
}
/**
* 返回的新闻以及是否还有更多新闻
*/
public class GetNews {
public String has_more;
public ArrayList<NewsDetail> data;
public String getHas_more() {
return has_more;
}
public ArrayList<NewsDetail> getData() {
return data;
}
/**
* 新闻返回的详细数据
*/
public class NewsDetail {
@SerializedName("abstract")
public String mabstract;
public String img_url;
@SerializedName("title")
public String mtitle;
public String url;
public String getMabstract() {
return mabstract;
}
public String getImg_url() {
return img_url;
}
public String getMtitle() {
return mtitle;
}
public String getUrl() {
return url;
}
}
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询