for example
jq .data
result : "hello"
I want to remove the double quotes in the result. What should I do?
What should I do?
Check the jq manual!
What should I do?
Check the jq manual!
thanks! i find "-r" or "--raw-output" in the manual..
@pkoppstein that has to be one of the most unuseful comments in the history of github
@sendtomoon thanks for sharing
From the manual (version jq-1.5-1-a5b5cbe installed on ubuntu 16.04)
· --join-output / -j:
Like -r but jq won´t print a newline after each output.
Would be useful to you if you're comparing the length of characters from an output to some other number. For instance, when using jq to find a UUIDv4 and checking its length to confirm it's 36 characters, jq -r will include a hidden newline character. Something to keep note of!
FTR -r does not work with @CSV, at least in 1.5.
@lleeoo - Please note that the -r command-line option does work as it is intended to, in all extant versions of jq. In particular, when used in conjunction with @csv, the -r option ensures that valid CSV is produced. This is accomplished by unconditionally quoting string values in each CSV line. If you want to eliminate the quotation marks (at the risk of not producing the intended CSV output), use @tsv and then blindly convert the tabs to commas. A more robust approach would be a bit more complicated, but it might not be worth the effort.
Thank you, @pkoppstein. I understand that the behaviour is as intended, and FWIW I think it is the correct behaviour at the current stage. I just put that reference here for people who will come to the page via Google. I found this SE answer to be a great summary of the topic. The entire question discussion is useful.
What I think might be helpful is if the string does not need quotes in CSV, then it shouldn't take them, but that is a nice-to-have.
What should I do?
Check the jq manual!

@sendtomoon thank you!
What should I do?
Check the jq manual!
That's really rude. I mean it's open source and all that but implementing something with so counter-intuitive approach and saying the users "RTFM" is just a very unpleasant user experience
This is the search term I used on google:
remove unwanted backslashes jq csv
Which showed this github issue as the second result. I fully understand that I should be RTFM. However when I have a deadline or any form of time constraint, or just can't be bothered, and knowing just one specific thing will solve my problem, github issues like these (or stackoverflow questions for that matter) help a lot. Thanks!
I also came here through a popular search engine, well aware that the information I need can be found through the man page, but thinking I could find the answer faster through said search engine. IMO, this is the kind of thing that would fit much better i.e. in stackoverflow rather than as a github issue. Anyway, found the -r-option here thanks to @sendtomoon and happy with that :-)
What should I do?
Check the jq manual!
That's really rude. I mean it's open source and all that but implementing something with so counter-intuitive approach and saying the users "RTFM" is just a very unpleasant user experience
But... it wasn't conveyed in a rude way at all. A helpful pointer was given to where this kind of information is officially provided. If the flag were to change for any reason, the actual manual would be updated, but anyone visiting this thread would be none the wiser.
Most helpful comment
thanks! i find "-r" or "--raw-output" in the manual..