Map ma=new HashMap<String,String>();
ma.put("ou", "ddddd");
ma.put("ou1", "ddddd1");
ma.put("ou2", "ddddd2");
ma.put("ou3", "ddddd3");
//map转string
JSONArray json = JSONArray.fromObject(map);
System.out.println(json.toString());
//String 转map
String s=json.toString();
s=s.replace("[", "");
s=s.replace("]", "");
JSONObject jo1=JSONObject.fromObject(s);
Map map1 = (Map)jo1;
System.out.println(map1);
ma.put("ou", "ddddd");
ma.put("ou1", "ddddd1");
ma.put("ou2", "ddddd2");
ma.put("ou3", "ddddd3");
//map转string
JSONArray json = JSONArray.fromObject(map);
System.out.println(json.toString());
//String 转map
String s=json.toString();
s=s.replace("[", "");
s=s.replace("]", "");
JSONObject jo1=JSONObject.fromObject(s);
Map map1 = (Map)jo1;
System.out.println(map1);