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就会自动转义
时间: 2024-12-08 00:32:42