JSONObject obj=new JSONObject();
obj.put("password","123");
obj.put("test","123222");
String a=obj.toString();
obj.put("params",a.substring(1,a.length()-1));
System.out.println(obj);
{"password":"123","test":"123222","params":"\"password\":\"123\",\"test\":\"123222\""}
在JSON里面再加入一次JSON就会自动转义
原文链接:https://www.f2er.com/json/289679.html