Bash Properties to JSON Converter
Convert Bash export statements into plain JSON. Each export KEY=VALUE line becomes a key-value pair in the resulting JSON object. The converter handles single-quoted, double-quoted, and unquoted values, strips inline comments, and properly escapes special characters.
Use Cases
- Config Portability — Move shell config into structured JSON format
- Documentation — Generate readable JSON from shell environment dumps
- Cross-Platform — Bridge shell-based configuration into JSON-native tooling
- Migration — Convert legacy shell export scripts to JSON config files
- CI/CD Pipelines — Transform build environment variables into JSON artifacts
- Docker Compose — Convert shell env exports into Docker
environmentblocks
Features
- Quote Handling — Single quotes (
'value'), double quotes ("value"), and bare values all work correctly - Comment Stripping — Inline
# commentsafter values are automatically removed - Special Characters — Tabs (
\t), newlines (\n), and escaped quotes are properly preserved - Empty Values — Variables with no value (
export EMPTY=) become empty strings - Unset Variables — Bare
export VARwith no=becomesnull
Example
Input (Bash):
export DATABASE_HOST='localhost'
export DATABASE_PORT='5432'
export APP_NAME='MyApp'
export APP_DEBUG="true"
export APP_SECRET='s3cr#t!'
export LOG_LEVEL=debug # inline comment ignored
export EMPTY_VAR=Output (JSON):
{
"DATABASE_HOST": "localhost",
"DATABASE_PORT": "5432",
"APP_NAME": "MyApp",
"APP_DEBUG": "true",
"APP_SECRET": "s3cr#t!",
"LOG_LEVEL": "debug",
"EMPTY_VAR": ""
}