{
"error":0,
"message":"ok",
"data":{
"multi":{
"100":{
"id":"5",
"name":"服务1",
"charge_type":"100",
"strike_price":"12000",
"market_price":"12000",
"remark":"啊啊啊啊"
},
"101":{
"id":"6",
"name":"服务2",
"charge_type":"101",
"strike_price":"3000",
"market_price":"3000",
"remark":"啊啊啊啊"
},
"102":{
"id":"8",
"name":"服务3",
"charge_type":"102",
"strike_price":"1000",
"market_price":"2000",
"remark":""
},
"103":{
"id":"9",
"name":"服务1",
"charge_type":"103",
"strike_price":"500",
"market_price":"1000",
"remark":""
}
},
}
}
解析方式:
public class Multi {
public String id, name, charge_type, strike_price, market_price, remark;
}
public ArrayList<Multi> multis = new ArrayList<>();
public void param(JSONObject object) {
JSONObject multiObject = object.optJSONObject("data").optJSONObject("multi");
Iterator iterator1 = multiObject.keys();
while (iterator1.hasNext()) {
String key = (String) iterator1.next();
JSONObject value = multiObject.optJSONObject(key);
Multi multi = new Multi();
multi.id = value.optString("id");
multi.name = value.optString("name");
multi.charge_type = value.optString("charge_type");
multi.strike_price = value.optString("strike_price");
multi.market_price = value.optString("market_price");
multi.remark = value.optString("remark");
multis.add(multi);
}
}