JSON to .env Converter

Turn a JSON config object into environment variables for dotenv, Docker and CI.

100% Client-Side Processing — your data never leaves this browser. Works offline. How it works

0 lines • 0 bytes Ready
Tip: drop a file anywhere on the editor
Input
Paste, type or drop a file
1
Result
Updates as you type
// Output will appear here…
About this tool

How the JSON to .env works

Convert JSON to a .env file. Nested keys become DATABASE_HOST style variables (or DATABASE__HOST), values are quoted when needed and a prefix can be added.

How to use the JSON to .env

  1. Paste a JSON object.
  2. Optionally set a prefix and key case.
  3. Copy or download the .env file.

JSON to .env example

Input
{"port":8080,"database":{"host":"localhost","port":5432},"features":["export","beta"]}
Result
PORT=8080
DATABASE_HOST=localhost
DATABASE_PORT=5432
FEATURES=export,beta

When to use it

  • Creating .env files for Docker Compose and local development.
  • Moving JSON config into CI/CD variables.
  • Generating environment settings for twelve-factor apps.

Tip: Never commit real secrets: keep .env in .gitignore and commit a .env.example with placeholder values.

Nested keys

database.host becomes DATABASE_HOST. Switch to double underscores (DATABASE__HOST) for .NET, Pydantic settings and other frameworks that rebuild nesting from them.

Safe quoting

Values with spaces, quotes, # or $ are double-quoted and escaped.

Prefix

Add a prefix such as APP to every variable: APP_PORT, APP_DATABASE_HOST.

Arrays

Lists of plain values become comma-separated strings; lists of objects use indexes.

FAQ

Common questions

Single or double underscores?

Single underscores (DATABASE_HOST) are the usual .env style. Choose double underscores when your framework turns DATABASE__HOST back into nested settings, as ASP.NET Core and Pydantic settings do; they also keep nesting distinct from underscores inside names.

Can I keep lowercase keys?

Yes, untick "UPPERCASE keys".

How are booleans and numbers written?

As plain text (true, 8080), since environment variables are strings.

Is my config uploaded?

No, the file is generated in your browser.