JSON to ENV Converter — Free Online

JSON to .env Converter

Paste a JSON config object and get a .env file with one KEY="value" line per setting — ready for dotenv, Docker --env-file or a CI pipeline. Conversion runs in your browser; nothing is uploaded.

How the conversion works

  • Nested keys are joined with underscores and uppercased: {"database": {"host": …}} becomes DATABASE_HOST.
  • Array items get an index suffix: "replicas": ["db2", "db3"] becomes DATABASE_REPLICAS_0 and DATABASE_REPLICAS_1.
  • Every value is written as a double-quoted string, so values with spaces or # survive.
  • The root must be an object — a JSON array or a single value has no keys to name variables after.

Example

{
  "app": { "name": "demo", "port": 8080, "debug": true },
  "database": { "host": "localhost", "replicas": ["db2", "db3"] }
}

becomes

APP_NAME="demo"
APP_PORT="8080"
APP_DEBUG="true"
DATABASE_HOST="localhost"
DATABASE_REPLICAS_0="db2"
DATABASE_REPLICAS_1="db3"

When to use it

  • Moving from a JSON config file to environment variables, as twelve-factor apps and most container platforms expect.
  • Seeding local development: turn config.example.json into a .env.example.
  • CI/CD secrets and variables — paste the output into your pipeline's variable settings.

Things to know

  • Environment variables are always strings: APP_PORT="8080" arrives as the text 8080. Parse numbers and booleans in your application.
  • Never commit a .env file that contains real secrets; commit a .env.example with placeholders instead.