今天遇到一种新的json串,幸好有人指点才解析出来,json串是这样子的
{
status : 200,
result :
{
选婚期 :
{
name : "选婚期",
id : "18489",
LID : "4db68b791d4a3eb8f5af60f225e2b022"
},
订婚 :
{
name : "订婚",
id : "18497",
LID : "b4bd187eaec604856dd2c5d7933e9c10"
},
登记结婚 :
{
name : "登记结婚",
id : "18613",
LID : "4faef74a393a0bbfa05cd7670c1fa900"
},
订酒店 :
{
name : "订酒店",
id : "19011",
LID : "9aa69db823aaf6c929130586fadd2b8f"
},
婚纱照 :
{
name : "婚纱照",
id : "19012",
LID : "fdaf6eda63d54ed75871224f1aeeb4a7"
},
订婚庆 :
{
name : "订婚庆",
id : "19046",
LID : "401ef3a09e83d290b75d98bbe286a254"
}
}
}
下面是Josn的那个解析类:
public class MerryBean extends BaseQZBean{
private Map<String,Marry> result;
public Map<String, Marry> getResult() {
return result;
}
public void setResult(Map<String, Marry> result) {
this.result = result;
}
public class Marry {
private String name;
private String id;
private String LID;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getLID() {
return LID;
}
public void setLID(String LID) {
this.LID = LID;
}
}
}
调用的时候
MerryBean bean = new Gson().fromJson(arg0.result, MerryBean.class);
好了,这样子就解析出来了