JSON to Shell/Bash Converter
Convert JSON to Shell/Bash variables instantly — free, browser-only, no data sent to any server.
JSON Input
Shell/Bash Output
What Is JSON to Shell/Bash?
You've got a JSON config file and a bash script that needs those values — now what? Manually copying key-value pairs into export statements is tedious and error-prone. This tool takes your JSON and generates shell variable declarations you can source directly. Bash scripts, CI/CD pipelines like GitHub Actions, and Docker entrypoints all benefit from sourcing a single env file. The JSON specification defines the input format, and POSIX shell syntax governs the output. For dynamic JSON parsing at runtime, jq is the right tool — this converter handles the static-config case where you just want variables ready to source.
Conversion runs in your browser. Set the variable prefix in the config panel. Nothing is sent to a server. For dynamic JSON parsing at runtime, use jq or grep with the JSON. This tool is for generating static variable assignments from known JSON.
How to Use This Tool
Paste or Upload JSON
Paste your JSON or upload a file. Set the variable prefix in the config panel.
Review the Shell Output
The right panel shows generated shell variable assignments. Use jq for dynamic JSON parsing in scripts.
Copy or Download
Use Copy or Download. For formatting JSON first, use the JSON Formatter. For validation, use the JSON Validator.
JSON to Shell Examples
Here is an example of generating shell variables from a JSON object.
Example: Subscriber record
JSON input:
Generated shell output:
When JSON to Shell Helps
When writing deployment scripts, CI/CD pipelines, or automation that needs config values from JSON, converting to shell variables lets you source the output and use $VAR in your script. For API responses or dynamic JSON, use jq at runtime. This tool is useful when you have static JSON (e.g. from a config file) and want to embed it as shell variables. For Windows, use JSON to PowerShell instead.
Frequently Asked Questions
What is the difference between bash and POSIX shell for this output?
The generated output uses common VAR="value" assignments that work in both bash and POSIX sh. For associative arrays (declare -A), bash 4+ is required — macOS ships with bash 3 by default, so you may need brew install bash. For maximum portability across shells, use jq at runtime instead.
When should I use jq instead of this tool?
Use jq when the JSON comes from a dynamic source (API call, pipeline output, file that changes at runtime). Use this tool when you have static JSON — a config file, a seed payload, a fixture — and you want to convert it once and source the result in a script.
Can I use the output directly in GitHub Actions?
Yes. GitHub Actions runners use bash. You can pipe the output into $GITHUB_ENV or source it in a run step. For parsing JSON from step outputs, the built-in fromJson() expression or jq is more flexible.
Is my JSON data safe to paste here?
Completely safe. Everything runs in your browser using JavaScript — nothing is sent to any server. You can verify this by opening your browser's Network tab while using the tool. No account required.
What happens with special characters like quotes or newlines?
Values with spaces, double quotes, or special characters are wrapped in single quotes or escaped. Check the output and test it in your target shell environment, since escaping behavior varies between shells.