Jackson 字符串转List


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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM