Support writing numbers as strings for CSV
See original GitHub issueIt would be nice to have a CSV feature similar to JSON feature JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS
. Enabling of the feature by mapper.enable(JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS)
doesn’t work for CSV.
I want to write an object of this class:
data class TestData(
val integer: Int,
val float: Float
}
as
"1","1.234"
not as
1,1.234
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Writing numbers as strings in a .csv file - MSDN - Microsoft
I'm trying to output a datgridview to a .csv file, it works fine but I'm having a small problem with numbers.
Read more >Write Number as string csv python - Stack Overflow
Convert the number to string with formatting operator; in your case: "%09d" % number .
Read more >[Solved] Writing long numbers to csv - CodeProject
Issue must be of data type. You must be converting data type double to string, which converts number into exponential form. e.g.. double...
Read more >How to write a mixed data (text and number) in a CSV file
I need to write a CSV file with text matrix in the first column and numbers matrix in the second column. Example. Theme....
Read more >csv — CSV File Reading and Writing — Python 3.11.1 ...
Each row read from the csv file is returned as a list of strings. ... other programs which read CSV files (assuming they...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @cowtowncoder, is this issue still up for grabs? This will be my first issue, and I’m interested in working on it.
@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
ALWAYS_QUOTE_STRINGS
, agreed; ifALWAYS_QUOTE_NUMBERS
is enabled, that would mean quoting regardless.