Map转JSONObject:
<!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.59</version>
</dependency>
JSONObject info= JSONObject.parseObject(JSON.toJSONString(map));
JSONObject转Map:
JSONObject json = new JSONObject();//这里就不赋值了
Map<String, String> params = JSONObject.parseObject(json.toJSONString(), new TypeReference<Map<String, String>>(){});
JSONObject转String:
JSONObject json = new JSONObject();//这里就不赋值了
String s = json.toString();
String转JSONObject: