fastjson解析:
resultValue=
[
{
"total": 1,
"saleLists": [
{
"categoryInfo": "測試父分類",
"id": 12,
"vendor_code": 0,
"brandInfo": "非龍品牌,",
}
]
}
]
第一步:解析完成之後 {"total": 1,"saleLists": [{"categoryInfo": "測試父分類","id": 12,"vendor_code": 0,"brandInfo": "非龍品牌,",}]}
JSONObject js=JSON.parseObject(JSON.parseArray(resultValue).get(0).toString());
第二步:解析完成後 [{"categoryInfo": "測試父分類","id": 12,"vendor_code": 0,"brandInfo": "非龍品牌,",}]java
JSONArray js2=JSON.parseArray(js.getString("saleLists").toString());
第三步:解析完成後 {"categoryInfo": "測試父分類","id": 12,"vendor_code": 0,"brandInfo": "非龍品牌,",}json
JSONObject jsObj2=JSON.parseObject(js2.get(0).toString());
第四步:js2jsObj2.getString("id"),獲得12測試