1.引入的包
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject;
实际代码
String paperContent = workHistory.getPaperContent(); List<QuestionPartDto> list = JSONObject.parseObject(paperContent, List.class); //这一步debug可以看到list里面仍然是jsonObject对象 List<QuestionPartDto> entityList1 = JSON.parseArray(JSON.toJSONString(list), QuestionPartDto.class); //走完这一步 就是正常的list对象了
标签:fastjson,List,JOSN,list,JSON,字符串,import From: https://www.cnblogs.com/onlyzhangmeng/p/17096338.html