.env to JSON Converter — Convert JSON to .env Too Convert between .env files and JSON.
100% offline
Input131 chars · 7 lines
Output151 chars
Converted · 5 keys
{
  "APP_NAME": "anvil",
  "PORT": "3000",
  "DEBUG": "true",
  "DATABASE_URL": "postgres://localhost:5432/app",
  "SECRET_KEY": "s3cr3t with spaces"
}

About .env to JSON Converter — Convert JSON to .env Too

A .env file stores configuration as plain `KEY=value` lines — database URLs, API keys, feature flags, ports. JSON is the format most tools, CI pipelines, and cloud providers actually want. This converter moves config between the two without copy-pasting line by line.

The .env → JSON direction parses real-world files: quoted values, the `export` prefix, `#` comments, blank lines, and multiline double-quoted strings. The JSON → .env direction flattens nested objects into `PARENT_CHILD` keys so a structured config collapses cleanly back into dotenv syntax.

Everything runs in your browser — no upload, no server. Since .env files routinely hold secrets, that offline guarantee matters: your keys never leave the device.

Features

  • Convert .env files to JSON and JSON back to .env
  • Parses quotes, the export prefix, comments, and multiline values
  • Flattens nested JSON to PARENT_CHILD keys
  • Runs fully offline — secrets never leave your browser

How to use

  1. Paste your .env file or JSON into the input pane.
  2. Choose ".env → JSON" or "JSON → .env" to pick the direction.
  3. Read the converted output and copy it from the output pane.

Frequently asked questions

How are quoted and commented .env lines handled?

Surrounding single or double quotes are stripped, and double-quoted values support \n escapes and can span multiple lines. Lines starting with # are treated as comments and ignored, as are blank lines and inline trailing comments on unquoted values.

How does nested JSON become a flat .env file?

Nested objects are flattened by joining keys with an underscore — {"db":{"host":"x"}} becomes DB_HOST=x. Keys are upper-cased, and values containing spaces or special characters are wrapped in double quotes.

Is the export prefix supported?

Yes. Lines like export KEY=value are parsed the same as KEY=value — the export keyword is recognized and stripped automatically.

Is it safe to paste secret keys here?

Yes. All parsing and conversion happen locally in your browser using built-in JavaScript — nothing is uploaded or logged. Your .env contents and any secrets stay on your device.

Everything runs locally in your browser — your input is never uploaded.