How to remove double-quotes in jq output for parsing json files in bash?
BashAwkSedJqBash Problem Overview
I'm using jq to parse a JSON file as shown here. However, the results for string values contain the "double-quotes" as expected, as shown below:
$ cat json.txt | jq '.name'
"Google"
How can I pipe this into another command to remove the ""? so I get
$ cat json.txt | jq '.name' | some_other_command
Google
What some_other_command
can I use?
Bash Solutions
Solution 1 - Bash
Use the -r
(or --raw-output
) option to emit raw strings as output:
jq -r '.name' <json.txt