标签:
//关于java map与JSONObject类互相转换
Map<String,Object> map=new HashMap<String,Object>();
map.put("zhang",1);
List<String> list=new LinkedList<String>();
list.add("zhang");
list.add("zhang");
list.add("zhang");
map.put("ss",list);
JSONObject obj=JSONObject.fromObject(map);
System.out.println(obj.toString());
// JSONArray 与java list array 的互转
JSONArray jsonarray=JSONArray.fromObject(list);
System.out.println(jsonarray.toString());
标签:
原文地址:http://www.cnblogs.com/zxf330301/p/5423075.html