question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support writing numbers as strings for CSV

See original GitHub issue

It 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:open
  • Created 3 years ago
  • Reactions:2
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
achmadafrizacommented, Feb 26, 2021

Hi @cowtowncoder, is this issue still up for grabs? This will be my first issue, and I’m interested in working on it.

1reaction
cowtowncodercommented, Feb 9, 2021

@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; if ALWAYS_QUOTE_NUMBERS is enabled, that would mean quoting regardless.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found