Inject a shell string into a jq program.
Section: Arguments and Shell Integration
Pass string variable
bash
bash
name=alice; jq -n --arg name "$name" '{name: $name}'Explanation
Use `--arg` for shell strings.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Arguments and Shell Integration
Read another JSON file into variable
Load a JSON file into jq as an array of documents.
Read one JSON file into variable
Load one JSON document into a jq variable.