0
var input = File(response)
        try {
            var csv = CsvSchema.emptySchema().withHeader();
            var csvMapper = CsvMapper();
            var mappingIterator: MappingIterator<Map<String, String>> =  csvMapper.reader().forType(Map.class).with(csv).readValues(input);
            val list: List<Map<String, String>> = mappingIterator.readAll();
            println(list);
        } catch(Exception e) {
            e.printStackTrace()
        }
    }

Issue is in the fortype() function in the line var mappingIterator: MappingIterator<Map<String, String>> = csvMapper.reader().forType(Map.class).with(csv).readValues(input);

iknow
  • 8,358
  • 12
  • 41
  • 68
  • Please mention What is the exact compiler error you are getting. – Sisir Jul 14 '20 at 08:57
  • On a related note, have tried using `csvMapper.readValue>()` – Sisir Jul 14 '20 at 08:58
  • The example you've given is not valid Kotlin code. Also, if you're using Jackson it may expect a Java class while you may be passing a Kotlin class. Try `.forType(Map::class.java)`. – fluidsonic Jul 17 '20 at 10:41

0 Answers0