import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
public static void main(String[] args) {
List<Map<String, Object>> list = new ArrayList<Map<String,Object>>();
Map<String, Object> map = new HashMap<String, Object>();
map.put("a", "b");
map.put("b", "c");
list.add(map);
String arrStr = JSONArray.fromObject(list).toString();//list转String
String objStr = JSONObject.fromObject(map).toString();//map转String
System.out.println(arrStr);//[{"b":"c","a":"b"}]
System.out.println(objStr);//{"b":"c","a":"b"}
JSONArray arr = JSONArray.fromObject(arrStr);
List<Map<String, Object>> list1 = JSONArray.fromObject(arrStr);
JSONObject obj = JSONObject.fromObject(objStr);
Map<String, Object> map1 = JSONObject.fromObject(objStr);
}