1.alibaba
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.51</version>
</dependency>
JSONObject json = new JSONObject(map);
JSONObject json = JSONObject.parseObject(s);
String s = JSONObject.toJSONString(map);
String s json.toJSONString();
Map<String, Object> map = (Map<String, Object>)json;
2. json-lib
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
JSONObject json = JSONObject.fromObject(map);
JSONObject json = JSONObject.fromObject(json.toString());
String s = json.toString();
3. google
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3.1</version>
</dependency>
String json=JSON.toJSONString(map);
Map map1 = JSON.parseObject(json);