Skip to content

Allow CSV to differentiate between null and empty fields (foo,,bar vs. foo,"",bar) #469

@PujolDavid

Description

@PujolDavid

I have not found any way to read a CSV that differentiate null and empty values.
I have played with various options and I also do a debug step by step in the jackson code.

The need is to be able to read a CSV generated by Postgres (and other apps) that make a difference between null and empty values.

Here an example of a 2 lines CSV:
foo,,bar
foo,"",bar

I expect to retrieve the following arrays:
["foo", null, "bar"]
["foo", "", "bar]

Can we add an option in CsvParser.Feature such as EMPTY_NON_QUOTED_STRING_AS_NULL?
This will also help to read CSV created with CsvGenerator.Feature.ALWAYS_QUOTE_EMPTY_STRINGS option

Thanks for taking time to read me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.18Fix or feature targeted at 2.18 releasepr-neededFeature request for which PR likely needed (no active development but idea is workable)

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions