-
-
Notifications
You must be signed in to change notification settings - Fork 149
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) Support writing numbers as quoted Strings with CsvGenerator.Feature.ALWAYS_QUOTE_NUMBERS
#198
Comments
Interesting... while semantics are slightly different (in CSV output everything is essentially a String), this could be closed enough.
would suggest that feature belongs here. And there is the question of how to combine these settings: I suspect addition quoting for numbers should be applied if either of these settings was enabled. |
My idea how should it work is as follows: Given this class
a) both features are enabled:
writes
b) only this feature is enabled
writes
So, it wouldn't make any difference in the final output when not set together with |
Actually, looking into this bit more I realized that |
I think I need this feature. Is there already some work done? If not maybe I can implement it, thankful for any input. If EDIT I just got word my consumers can probably still parse the CSV with "smart" quotes, so I might not need that feature. |
@MrBuddyCasino I did not have time to implement this (it was one of top things I'd ideally wanted to have in 2.12 but didn't quite make it), so would be great to get help here. But if not, then maybe someone else has time, would still like this feature either way. :) As to |
Hi @cowtowncoder, is this issue still up for grabs? This will be my first issue, and I'm interested in working on it. |
@achmadafriza yes, this is up for grabs. If you want to work on it, target would be |
In case somebody comes here after crazy googling like I did: I had the reverse problem - reading in numbers into strings would fail unless I used the now deprecated |
Hi @cowtowncoder, @achmadafriza |
@BertKoor Looking at the discussion, I don't think this was implemented. It would be good to get it done but I'd need help here -- would be happy to get PR merged, help with details. One thing that is often helpful as a starting point is to create a (failing) test to show how things ought to work, create PR for that. In this case you'd probably need to add an entry in |
CsvGenerator.Feature.ALWAYS_QUOTE_NUMBERS
Decided to go with |
It would be nice to have a CSV feature similar to JSON feature
JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS
. Enabling of the feature bymapper.enable(JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS)
doesn't work for CSV.I want to write an object of this class:
as
"1","1.234"
not as
1,1.234
The text was updated successfully, but these errors were encountered: