Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(csv) Missing null writes when writing Object[] values #10

Open
cowtowncoder opened this issue Mar 20, 2017 · 6 comments
Open

(csv) Missing null writes when writing Object[] values #10

cowtowncoder opened this issue Mar 20, 2017 · 6 comments
Labels

Comments

@cowtowncoder
Copy link
Member

(moved from FasterXML/jackson-dataformat-csv#116 by @georgewfraser)

When writing arrays to CSV, if there is a null, columns get written out of order. Reproduced in 2.7.1 with this test: https://gist.github.com/georgewfraser/164647fbaca61aadf9ee

@cowtowncoder
Copy link
Member Author

cowtowncoder commented Mar 20, 2017

More likely related to #116 (?): looks like nulls for "array in array" are suppressed. This could be somewhat problematic even for other entries since "null value" would not get written.

@cowtowncoder cowtowncoder changed the title Missing null writes when writing Object[] values (csv) Missing null writes when writing Object[] values Mar 20, 2017
@daliclass
Copy link

daliclass commented Jun 2, 2018

@cowtowncoder Hey, Is anyone working on this I would be happy to pick it up

Added a gist for the current behaviour in 2.9.0 and what I think the desired behaviour should be

https://gist.github.com/daliclass/19507eb79939e6ad716b30cd241c612b

@ganchurin
Copy link

@cowtowncoder Is there any workaround for the issue?

@cowtowncoder cowtowncoder added 2.10 and removed 2.9 labels Aug 19, 2019
@cowtowncoder
Copy link
Member Author

@ganchurin not aware of work-arounds unfortunately. If anyone has time to look into this, I would be happy to help validate fix, integrate, but right now I do not have time in short term. I will add this as something to (re-)evaluate tho as it is an important issue.

@gimiz
Copy link

gimiz commented Dec 11, 2019

Workaround:
Before writing change null value to an empty string. In not-quoted CSV empty string looks the same as null (separator only).
If you need to use qouteChar, set CsvGenerator.Feature.ALWAYS_QUOTE_STRINGS to false to use quotes only when necessary. Empty string will stay not-quoted.
If you need all values quoted, use another library.

@cowtowncoder cowtowncoder added 2.13 and removed 2.10 labels Nov 10, 2020
pierre added a commit to killbill/killbill-analytics-plugin that referenced this issue Jun 23, 2021
Work around FasterXML/jackson-dataformats-text#10.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
pierre added a commit to killbill/killbill-analytics-plugin that referenced this issue Jun 23, 2021
Work around FasterXML/jackson-dataformats-text#10.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
@cowtowncoder cowtowncoder removed the 2.13 label Apr 22, 2023
@PascalSchumacher
Copy link

This also affects writing Lists (at least in version 2.17.2). @gimiz Thank you very much for the workaround!

By the way: Thank you very much for developing/providing Jackson.

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

No branches or pull requests

5 participants