Skip to content
This repository has been archived by the owner on Jan 22, 2019. It is now read-only.

Add a way to specify "null value" (String) for CsvGenerator to use when writing nulls #53

Closed
cowtowncoder opened this issue Oct 29, 2014 · 3 comments
Milestone

Comments

@cowtowncoder
Copy link
Member

Looks like many CSV processors allow use of specific placeholder to use instead of Java null, instead of empty String. We should allow that as well; and with 2.5, may be able to configure it nicely on per-call basis via ObjectWriter as well.

cowtowncoder added a commit that referenced this issue Oct 30, 2014
@cowtowncoder cowtowncoder added this to the 2.5.0 milestone Oct 30, 2014
@cowtowncoder
Copy link
Member Author

Implemented; used like:

CsvSchema schema = CsvSchema.builder()
    .setNullValue("n/a")
    .build();

@flappingeagle
Copy link

nice, we will use this to serialize null-values as "(null)" like the DBVisualizer-App does it ;)

It would be nice if this configuration also works for deserialization. For example, the following call would not recognize this configuration and will return the String "(null) " in the resulting map while parsing a csv-file:

        Map<String, String> line = csvReader.nextValue();

but its also no problem for us to post-process this ourselves...

@cowtowncoder
Copy link
Member Author

Good idea; I agree in that this would make sense. Could you file a separate issue so this is easier to track?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants