Build JSON from shell variables.
Section: Logs and Reporting
Convert env vars into JSON object
bash
bash
APP_NAME=cheatsheet ENV=prod jq -n --arg app "$APP_NAME" --arg env "$ENV" '{app: $app, env: $env}'Explanation
A strong pattern for shell scripting and automation.
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 Logs and Reporting