Home » Java » java – Handle values as NULLs in OpenCSV-Exceptionshub

java – Handle values as NULLs in OpenCSV-Exceptionshub

Posted by: admin February 25, 2020 Leave a comment

Questions:

I have a problem converting SQL result nulls to Java nulls parsing CSV with OpenCsv.

I have CSV in the next format:

"DAY", "METHOD", "VALUE"
"2020-01-01", "<NULL>", "9450422"
"2020-01-03", "Method A", "9450422"

I’m using CsvToBean to convert this data to a list of POJOs. But I want value <NULL> to be handled as null for my Pojo. How can I do it in OpenCSV?

Thanks.

How to&Answers: