public class LoginInfo { java
private String status;
private String message; android
private Entity data = new Entity(); ide
public void setStatus(String status) {
this.status= status;
}
public String getStatus() {
return status;
}
public void setMessage(String message) {
this.message= message;
}
public String getMessage() {
return message;
} this
public Entity getData(){
return data;
}
public void setData(Entity data){
this.data = data;
} spa
} code
調用的方法:LoginInfo info = JSON.parseObject(content, LoginInfo); token
上面的content爲
{
"Status":"S",
"Message":"登陸成功!",
"Data":
{
"Name":"管理員",
"Email":"aaccca@qq.com",
"RoleName":"管理員",
"Token":"4e5528886",
"UserCode":"admin",
"UserPhone":"132xxxxxxxx",
"ISonduty":0,
"SetRate":5,
"PosCode":
{
"Name":"主管",
"Code":"01"
},
"Dept":
[
{
"Name":"北京xxxxxxxx總公司",
"Code":"0001"
}
],
"ChildDept":
[
{"Name":"上海xxxxxxxx總公司","Code":"0001"},
{"Name":"廣州分公司","Code":"00010001"},
{"Name":"上海分公司","Code":"00010002"},
{"Name":"北京分公司","Code":"00010003"}
]
}
} get
反序列化出來的結果是 it
List<NameCode> Dept 和List<NameCode> ChildDept 列表裏都爲空,而正常應該有內容的 class
謝謝你們指點,哪裏出錯了,謝謝