你要字符串转json格式,还是json转字符串?
JSONObject json_result = new JSONObject();
json_result.put("userId","");
JSONObject initParame = new JSONObject();
initParame.put("contextConfigLocation", "cfl");
json_result.put("initParameterNamesMaps", initParame);
System.out.println(json_result);
这个是字符串转json,你要导入json包