JSON解析

服务器端:

ArrayList> list = new ArrayList>();

HashMap map1 = new HashMap();
map1.put("name","violet");
map1.put("sex","nv");
list.add(map1);
JSONObject jo = new JSONObject();
jo.put("stulist",list);

PrintWriter pw = response.getWriter();
pw.priintln(jo);
pw.flush();
pw.close();

客户端:

JSONObject jo = new JSONObjet(data);

JSONArray ja = jo.getJSONArray();

for(int i=0;i

你可能感兴趣的:(JSON解析)