字符串转JSONArray 然后遍历array
下载
Java代码
List<String>helpPersonList=newArrayList<>();
List<String>oraList=newArrayList<>();
Stringjson="[{"aid":"aid-0035","aidName":"贾线柳","aidType":"1","organization":"镇财政分局"}]";
JSONArrayjsonArray=JSONArray.fromObject(json);
for(intj=0;j<jsonArray.size();j++){
JSONObjectjsonObject=jsonArray.getJSONObject(j);
StringaidName=jsonObject.getString("aidName");
Stringorg=jsonObject.getString("organization");
if(jsonArray.size()==1){
helpPersonList.add(aidName);
}else{下载
helpPersonList.add(aidName+"("+povertys.get(i).getPoorName()+")");
}
oraList.add(org);
}