bashawksedjq

How to remove double-quotes in jq output for parsing json files in bash?


I'm using jq to parse a JSON file as shown here. However, the results for string values contain the "double-quotes" as expected:

$ cat json.txt | jq '.name'
"Google"

How can I pipe this into another command to remove the ""?

$ cat json.txt | jq '.name' | other_command
Google

Solution

  • Use the -r (or --raw-output) option to emit raw strings as output:

    jq -r '.name' <json.txt