I have a POJO with a List within it. I am trying to export the POJO to CSV data. Used jackson-dataformat-csv 2.6.3 library to do it. But failed to write the list values to it. Is there a way to do it.
Class ABC {
String name;
List<DEF> list = new ArrayList();
//getters and setters
}
// Code to export or write to output stream
CsvMapper lCsvMapper = new CsvMapper();
CsvSchema lCsvSchema = lCsvMapper.schemaFor(ABC.class).withHeader();
//inputData is the ABC instance
lCsvMapper.writer(lCsvSchema).writeValue(aInOutputStream, inputData);