Skip to content

Conversation

@into-the-v0id
Copy link

Currently all string values are quoted when using the CSV formatter:

$ echo '["hello", "world", "hello,world"]' | jq -r '@csv'
"hello","world","hello,world"

This PR changes that to only quote string values when actually needed:

$ echo '["hello", "world", "hello,world"]' | jq -r '@csv'
hello,world,"hello,world"

Here is a more extensive example:

$ echo '[0, null, true, "hello", "hello,world", "a\"b", "one\ntwo", "foo, \"bar\nbaz\" end"]' | jq -r '@csv'
0,,true,hello,"hello,world","a""b","one
two","foo, ""bar
baz"" end"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant