JSON to .env Converter
Turn JSON into a .env file with upper-case keys joined by underscores, ready for Docker, Vercel and dotenv.
How to convert JSON to a .env file
Paste your JSON
Paste or type it into the box, or press Try an example.
Add a prefix
Optional, such as APP_, placed in front of every name.
Choose the case
Upper-case the names, as .env files usually expect.
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.