List<Map>转换为List<实体>

List<YourEntityClass> entityList = JSON.parseArray(JSON.toJSONString(mapList), YourEntityClass.class);

List<YourEntityClass> entityList = JSON.parseObject(JSON.toJSONString(mapList), new TypeReference<List<YourEntityClass>>() {});

List<YourEntityClass> entityList = mapList.stream().map(i -> JSON.parseObject(JSON.toJSONString(i), YourEntityClass.class)).collect(Collectors.toList());

 

posted @ 2025-12-22 14:15  一隅桥畔  阅读(1)  评论(0)    收藏  举报