我必须以这样的结构解析 webService 返回的 JSON 字符串:
{
"catList" : {
"1" :{
"name" : "NAME",
"qty" : "QTY",
"groupList" : {
"40" : {
"name" : "NAME",
"qty" : "QTY",
"subjectList" : {
"1" : {
"name" : "NAME",
"qty" : "QTY",
},
"5" : {
"name" : "NAME",
"qty" : "QTY",
},
...
},
"45" : {
"name" : "NAME",
"qty" : "QTY",
"subjectList" : {
"23" : {
"name" : "NAME",
"qty" : "QTY",
},
"45" : {
"name" : "NAME",
"qty" : "QTY",
},
...
},
...
"2" :{
"name" : "NAME",
"qty" : "QTY",
"groupList" : {
"142" : {
"name" : "NAME",
"qty" : "QTY",
"subjectList" : {
"86" : {
"name" : "NAME",
"qty" : "QTY",
},
"23" : {
"name" : "NAME",
"qty" : "QTY",
},
...
},
"7" : {
"name" : "NAME",
"qty" : "QTY",
"subjectList" : {
"98" : {
"name" : "NAME"
"qty" : "QTY"
},
"08" : {
"name" : "NAME"
"qty" : "QTY"
}
},
...
},
...
"3" :{SAME OTHERS},
"4" :{SAME OTHERS},
"5" :{SAME OTHERS},
"6" :{SAME OTHERS},
"7" :{SAME OTHERS},
"8" :{SAME OTHERS},
"9" :{SAME OTHERS},
}
我不知道怎么办?!我有一些像这样的课程:
public class CatList {
private String name;
private String qty;
private JSONObject groupList;
}
public class GroupList {
private String name;
private String qty;
private JSONObject subjectList;
}
public class SubjectList {
private String name;
private String qty;
}
但是因为 groupLists 和 subjectList 有随机标题,我不知道如何识别它们。这可能吗?我能怎么做?请帮忙