-
-
Notifications
You must be signed in to change notification settings - Fork 98
Closed
Description
Prerequisites
version: csvtk v0.30.0
Describe your issue
I have noticed four issues with the csv2json command.
command: csvtk csv2json testdata.csv -o testdata.json
input file testdata.csv:
test
none
"Make America ""great"" again"
\nations
"This is a
MULTILINE
string"
actual output file testdata.json:
[
{
"test": null
},
{
"test": "Make America "great" again"
},
{
"test": "\nations"
},
{
"test": "This is a
MULTILINE
string"
}
]
expected output file testdata.json:
[
{
"test": "none"
},
{
"test": "Make America \"great\" again"
},
{
"test": "\\nations"
},
{
"test": "This is a\nMULTILINE\nstring"
}
]
Comments:
-
issue 1: I want "none" to be depicted literally and neither changed to "null" (no option) nor "" (empty string with option -b)
-
issue 2: In JSON, double quotes have to be escaped with a backslash (
\") -
issue 3: In JSON, backslashes have to be escaped with a backslash (
\\) -
issue 4: In JSON, the line breaks of a CSV multiline cell have to be depicted as
\n
Thank you
Thank you very much for the great csvtk tool!
Metadata
Metadata
Assignees
Labels
No labels