问题:
Could not write JSON: lazy loading outside command context; nested exception is com.fasterxml.jackson.databind.JsonMappingException: lazy loading outside command context
解决:
借助hutool工具
pom.xml中
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.3.9</version>
</dependency>
list转换
cn.hutool.json.JSONArray array = new cn.hutool.json.JSONArray();
list.forEach(l-> array.add(JSONUtil.parseObj(l, true)));