-
json字符串转List
ObjectMapper objectMapper=new ObjectMapper(); List<Bean> list=objectMapper.readValue(“”,new TypeReference<List<Bean>>(){}); 或者 ObjectMapper objectMapper=new ObjectMapper(); JavaType javaType=objectMapper.getTypeFactory().constructParametricType(List.class,Bean.class); List<Bean> list=objectMapper.readValue(“”,javaType);
-
List转json
ObjectMapper mapper = new ObjectMapper(); String s = mapper.writeValueAsString(list);
Jackson的json字符串与List的互转
最新推荐文章于 2024-01-08 16:38:58 发布