JSONObject遍历获取键值

时间:2021-04-20 19:09:41
public static void main(String[] args) throws JSONException {
String str
= "{FYXID:4C4600835174411190C739805DE593BC,ZFY:0,FYXMC:保安保洁费}";
JSONObject jsonObject
= new JSONObject(str);
Iterator
<String> it = jsonObject.keys();
while(it.hasNext()){
// 获得key
String key = it.next();
String value
= jsonObject.getString(key);
System.out.println(
"key: "+key+",value:"+value);
}

 

用的miniui的例子调了一个下午终于TM调好了,有空再把miniUI excelExport导出的贴上