Map map =new HashMap();
map.put("username", 1);
map.put("message", 1);
String msg= JSONUtils.toJSONString(map);
System.out.println(msg);
}
需要的jar
<!--alibaba json -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.46</version>
</dependency>