标签:系统底层 abi depend artifact color ack class ppi json
1.pom.xml
<dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.8.5</version> </dependency>
2.测试代码
@RequestMapping("/doMapJsonString") @ResponseBody public Map<String,Object> doMapJsonString(){ Map<String, Object> map = new LinkedHashMap<>(); map.put("id", 100); map.put("name", "BeiJing"); return map; //系统底层会基于返回值查找对应的转换,将对象转换为指定格式的字符串 } @RequestMapping("/doMapJsonString02") @ResponseBody public List<Map<String,Object>> doMapJsonString02(){ List<Map<String,Object>> list = new ArrayList<>(); Map<String, Object> map = new LinkedHashMap<>(); map.put("id", 100); map.put("name", "BeiJing"); list.add(map); map = new LinkedHashMap<>(); map.put("id", 200); map.put("name", "ShangHai"); list.add(map); return list; //系统底层会基于返回值查找对应的转换,将对象转换为指定格式的字符串 }
3.结果
[{"id":100,"name":"BeiJing"},{"id":200,"name":"ShangHai"}]
标签:系统底层 abi depend artifact color ack class ppi json
原文地址:https://www.cnblogs.com/yikuan-919/p/9739869.html