Skip to content

Loading the editor only when it is ready

JSON to Bash Variables Converter

Transform any nested JSON object into ready-to-source Bash export statements. Keys are uppercased with underscore separators. Values use single quotes (') to prevent all shell expansion — no $, backticks, or other metacharacters can be accidentally evaluated.

Use Cases

  • Shell Scripts — Generate environment variable exports for bash scripts
  • Docker Entrypoints — Create source-able env files for container startup
  • CI/CD Pipelines — Convert build config into shell-accessible variables
  • DevOps Automation — Bridge JSON config with shell-based tooling

Example

Input:

{
  "database": {
    "host": "localhost",
    "port": 5432,
    "credentials": {
      "user": "admin",
      "password": "s3cret"
    }
  },
  "app": {
    "name": "MyApp",
    "debug": true,
    "servers": ["web1", "web2", "web3"]
  }
}

Output (default mode):

export DATABASE_HOST='localhost'
export DATABASE_PORT='5432'
export DATABASE_CREDENTIALS_USER='admin'
export DATABASE_CREDENTIALS_PASSWORD='s3cret'
export APP_NAME='MyApp'
export APP_DEBUG='true'
export APP_SERVERS[0]='web1'
export APP_SERVERS[1]='web2'
export APP_SERVERS[2]='web3'

Output (CSV arrays mode):

export DATABASE_HOST='localhost'
export DATABASE_PORT='5432'
export DATABASE_CREDENTIALS_USER='admin'
export DATABASE_CREDENTIALS_PASSWORD='s3cret'
export APP_NAME='MyApp'
export APP_DEBUG='true'
declare -a APP_SERVERS=('web1' 'web2' 'web3')