Skip to content
Loading the editor only when it is ready

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 environment blocks

Features

  • Quote Handling — Single quotes ('value'), double quotes ("value"), and bare values all work correctly
  • Comment Stripping — Inline # comments after 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 VAR with no = becomes null

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": ""
}

Related Tools

Try these complementary developer tools:

Popular Developer Tools

Most-used tools on LangStop