Fastjson转换json到带泛型的对象(如Map)报错解决

        List<CategoryDTO> categoryList = null;
        String categoryStr = redisService.get(RedisKeyConstant.CMS_CATEGORY);
        if (StringUtil.isNotBlank(categoryStr)) {
            categoryList = JSON.parseObject(categoryStr, new TypeReference<List<CategoryDTO>>(){});
        }for(CategoryDTO category:categoryList){
        }
List<CategoryDTO> categoryList = null;
String categoryStr = redisService.get(RedisKeyConstant.CMS_CATEGORY);
if (StringUtil.isNotBlank(categoryStr)) {
categoryList = JSON.parseObject(categoryStr, new ArrayList<CategoryDTO>().getClass());
}
return categoryList;

https://blog.csdn.net/zzzgd_666/article/details/96431040

原文地址:https://www.cnblogs.com/cuiqq/p/11990095.html