Skip to content
Advertisement

How to map a CSV to Object with List using CsvMapper?

I’m trying to map a Csv file to an Object what instances List of Objects using CsvMapper, is that even possible?

Example:

Content of Csv file (without header):

Field 1: name

Field 2: gender

Field 3: hobby (List comma separated)

Field 4: relation

JavaScript

Example class:

JavaScript
JavaScript

Thank you in advance.

Advertisement

Answer

I found myself a solution: I used common-cdv (apache) as a plugin instead of Jackson CsvMapper.

My solution:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement