Jackson 字符串转List<Map>

String a = "[{\"id\":27,\"text\":\"网络\"},{\"id\":32,\"text\":\"机身内存\"}]";
ObjectMapper objectMapper = new ObjectMapper();
CollectionLikeType type = objectMapper.getTypeFactory().constructCollectionLikeType(List.class, Map.class);
List<Map> listMap = objectMapper.readValue(a, type);

  

ObjectMapper objectMapper = new ObjectMapper();
CollectionLikeType type = objectMapper.getTypeFactory().constructCollectionLikeType(List.class, Map.class);
List<Map> listMap = objectMapper.readValue(typeTemplate.getSpecIds(), type);
posted @ 2018-09-08 16:51  httpslly  阅读(3412)  评论(0编辑  收藏  举报