JSON to .env Converter

FreePrivateInstant
JSON input
.env output
Ctrl+Enter Convert to .env

JSON to .env Converter

Convert a JSON config object to a .env file format. Nested objects are flattened with underscore separators, all keys are uppercased, and values with spaces are quoted. Useful when moving config from a JSON file to environment variables for a Node.js, Python, or Docker deployment. Runs entirely in your browser.

Where Is This Useful?

Migrating JSON config to environment variables
Many apps start with a config.json file and later need to move to environment variables for 12-factor app compliance or container deployments. This tool converts your config in one step.
Docker and CI/CD secrets
Docker Compose, GitHub Actions, and most CI platforms accept environment variables in KEY=value format. Convert your app config JSON to the correct format to paste into your pipeline or Compose file.
Generating .env.example files
Paste your app config with placeholder values and convert to .env format to create the.env.example file your team uses to set up a local development environment.

How to Use

  1. Paste a JSON object in the input panel
  2. Click Convert to .env or press Ctrl+Enter
  3. Review the output — nested keys are flattened with _ and uppercased
  4. Copy or download as a .env file

Conversion Rules

  • All keys converted to UPPERCASE
  • Nested objects flattened: database.hostDATABASE_HOST
  • String values with spaces wrapped in double quotes
  • Numbers and booleans written as-is (no quotes)
  • Arrays serialized as JSON strings
  • Null values written as empty: KEY=

Frequently Asked Questions

How are nested objects handled?

Nested objects are flattened recursively with underscore separators. { "db": { "host": "localhost" } } becomes DB_HOST=localhost.

Are values with spaces quoted?

Yes. String values containing spaces are wrapped in double quotes to ensure they are parsed correctly by dotenv and shell environments.

Can I use this with dotenv libraries?

Yes. The output is compatible with dotenv (Node.js), python-dotenv, and standard shell export syntax.

How is this different from JSON to TOML?

JSON to TOML is for configuration files that tools read directly. .env format is specifically for injecting values as environment variables into a running process.

Is my JSON uploaded anywhere?

No. Everything runs locally in your browser. Your data never leaves your machine.

Related Tools