By default jq prints strings with JSON quotes. -r (raw output) drops them — essential when the
output feeds another command or a file.
Example input
[
{ "name": "Ada", "age": 36 },
{ "name": "Linus", "age": 54 }
]
Raw values (no quotes)
jq -r '.[].name' data.json
Ada
Linus
String interpolation
Build a string with \(expr) inside double quotes:
jq -r '.[] | "\(.name) is \(.age)"' data.json
Ada is 36
Linus is 54
Join an array into one line
jq -r '[.[].name] | join(", ")' data.json # Ada, Linus
Emit shell-ready lines
jq -r '.[] | "useradd \(.name)"' data.json
useradd Ada
useradd Linus
Split / build paths
echo '"a/b/c"' | jq -r 'split("/") | .[-1]' # c
-r only affects top-level string output — numbers, objects and arrays still print as JSON.
Combine with interpolation to template config lines or commands, then pipe to bash, xargs, or a
file. Use @sh (jq -r '.[] | @sh "echo \(.name)"') when values must be safely shell-quoted.