开发

软件开发相关知识

Java中Hashmap或者map转化为json字符串

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));