<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.41</version>
</dependency>
alibaba的fastjson用法:
String jsonString = JSON.toJSONString(map,SerializerFeature.WriteMapNullValue,SerializerFeature.WriteNullStringAsEmpty);(Map转JSONObject)
JSONObject jm = JSON.parseObject(jsonString );(Map转JSONObject)
jm .put("name", "John");
JSONArray json = new JSONArray();
json.add(jm );