String s="{"error":"0","msg":"读取成功","addressjson":[{"id":"3","name":"成龙","p":"130000","c":"130300","d":"130321","address":"在哪里","zcode":"58888","phone":"1366815555","def":"0"}]}";
try { JSONObject obj= new JSONObject(s); Iterator it = obj.keys(); String vol = "";//值 String key = null;//键 while(it.hasNext()){//遍历JSONObject key = (String) it.next().toString(); vol = obj.String(key); } } catch (JSONException e) { e.printStackTrace(); }
本文通过一个具体的示例展示了如何使用Java处理JSON字符串。其中包括创建JSONObject对象、遍历键值对等基本操作。
6424

被折叠的 条评论
为什么被折叠?



