java报错
"JSON parse error: Cannot construct instance of `java.util.ArrayList` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value (''); nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `java.util.ArrayList` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('')\n at [Source: (PushbackInputStream); line: 1, column: 1981] (through reference chain: com.icbccs.dragonfly.model.DTO.base.DFSUser_DTO[\"oaDeptList\"])"
}
因为fastjson 在json解析的的时候 无法将''转换成jsonarray。需要[]才能转换。
解决方法:
其中一种简单解决方案:
private List<xxx> xxxList = new ArrayList<>();
文章描述了一个Java应用程序在使用Fastjson进行JSON解析时遇到的问题,具体是无法将空字符串()转换为ArrayList实例。错误信息表明缺少适合的构造函数或工厂方法。解决方案是确保JSON数据中的数组不为空,例如使用`[]`。文章提供了一个简单的修复示例,即初始化ArrayList时传入类型参数。
4639





