pom.xml添加 fastjson 依赖
<dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>${fastjson.version}</version> </dependency>
java程序中
Map<String, Object> data = new HashMap<String, Object>(); data.put("aaa","bbb"); System.out.println(com.alibaba.fastjson.JSON.toJSONString(data));