一,引入依赖
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.47</version>
</dependency>
二,对象转成JSON字符串
String returnValue = JSONObject.toJSONString(对象);
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.47</version>
</dependency>
String returnValue = JSONObject.toJSONString(对象);