Gson解析json 用Javabeen照射的方法 但是调不出最后的getName函数
Gson解析json 用Javabeen映射的方法 但是调不出最后的getName函数
下面是json 和编写的对应的Been类 是格式不对吗 只能调到been.getRs().getRows() 这一层!
------解决思路----------------------
been.getRs().getRows().get(0).getName()
下面是json 和编写的对应的Been类 是格式不对吗 只能调到been.getRs().getRows() 这一层!
{"slay":"1","rs":{"total":45,"rows":[{"name":"张三","phone":"111111"}]}}
public class Been {
public String slay;
public Rs rs ;
public String getSlay() {
return slay;
}
public void setSlay(String slay) {
this.slay = slay;
}
public Rs getRs() {
return rs;
}
public void setRs(Rs rs) {
this.rs = rs;
}
public static class Rs{
public String total;
public List<Rows> rows;
public String getTotal(){
return total;
}
public void setTotal(){
this.total=total;
}
public List<Rows> getRows(){
return rows;
}
public void setRows(){
this.rows=rows;
}
public static class Rows{
public String name;
public String phone;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
}
}
}
------解决思路----------------------
been.getRs().getRows().get(0).getName()