Bash Properties to JSON Converter — Free Online
Bash Properties to JSON Converter
Paste shell variable assignments — a sourced config file, /etc/default/*, os-release, a systemd EnvironmentFile or a block of export lines — and get a JSON object. Conversion runs in your browser; nothing is uploaded.
How the conversion works
- Both
NAME=valueandexport NAME=valueare read. - Matching quotes are removed:
'hello world'and"hello world"both becomehello world. - Comments (
#, including a#!/bin/bashline) and blank lines are skipped. - Only valid variable names are read — letters, digits and
_, not starting with a digit. Other lines, such as commands or function definitions, are ignored. - Values stay strings, exactly as the shell would see them.
Example
#!/bin/bash
export APP_NAME="demo"
export APP_PORT=8080
DB_HOST=localhost
export GREETING='hello world'becomes
{
"APP_NAME": "demo",
"APP_PORT": "8080",
"DB_HOST": "localhost",
"GREETING": "hello world"
}What is not evaluated
The file is read as text, never executed. That keeps it safe, but it means shell features are not expanded:
$HOMEor${VAR}references stay as literal text.- Command substitutions such as
$(date)are not run. - Values spanning several lines and arrays (
ARR=(a b c)) are not supported.
When to use it
- Inspect or document the variables a deploy script sets.
- Migrate shell-based configuration to a JSON or YAML config file.
- Compare environments — convert two config files and diff the JSON.
Related tools
- JSON to Bash — the reverse direction
- Bash properties to YAML
- .env to JSON