utility-option

jq --arg

Bind a string to a jq variable without inserting it into filter source. --argjson instead expects valid JSON. Quote shell arguments.

Formal Syntax & Structure

bash syntaxbash
jq -n --arg NAME VALUE FILTER

Return Value

exit status

Bind a string to a jq variable without inserting it into filter source. --argjson instead expects valid JSON. Quote shell arguments.

Working Example

Example Snippetbash
name='Ada "A"'jq -cn --arg name "$name" '{name:$name}'
Bash Reference