MappingIterator<Map<?, ?>> mappingIterator = csvMapper.reader(Map.class).with(bootstrap).readValue(file.getInputStream());
以上代码抛出此错误:
java.util.LinkedHashMap cannot be cast to com.fasterxml.jackson.databind.MappingIterator
最佳答案
发生这种情况是因为获取 MappingIterator 的方法是 readValues 而不是 readValue。
第二个方法“readValue”(不带“s”)用于从架构中读取单个值。
关于java - 我在使用此代码将 csv 转换为 json 架构时收到此错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27817809/