JSON to .env Converter

Turn JSON into a .env file with upper-case keys joined by underscores, ready for Docker, Vercel and dotenv.

Processed on your device. Files are not uploaded

How to convert JSON to a .env file

  1. Paste your JSON

    Paste or type it into the box, or press Try an example.

  2. Add a prefix

    Optional, such as APP_, placed in front of every name.

  3. Choose the case

    Upper-case the names, as .env files usually expect.

  4. Copy or download

    Save the output as a .env file. Keep it out of version control if it holds secrets.

Worked example

This is what JSON to .env Converter gives for its own sample values. Open the tool above and change anything to try your own.

JSON

{
  "db": { "host": "localhost", "port": 5432, "password": "p@ss word" },
  "debug": true
}
Prefix
Upper-case the names
Yes

.env

DB_HOST=localhost
DB_PORT=5432
DB_PASSWORD="p@ss word"
DEBUG=true

About JSON to .env Converter

Turn JSON into environment variables for a .env file. Nested keys are joined with underscores and written in capitals, and values with spaces or special characters are quoted.

FAQs

How are nested keys named?

They are joined with underscores, so db.host becomes DB_HOST.

Can I add a prefix?

Yes. Enter it in the prefix box, for example APP_.

Should I put secrets here?

Your data stays in the browser, but never commit a .env file that holds secrets to a public repository.

Related tools