.env ↔ JSON Converter

Parse .env files into JSON with full dotenv semantics — comments, export prefixes, single and double quotes, escape sequences, and multiline values — or generate a clean .env from a JSON object, with nested keys flattened to UPPER_SNAKE_CASE. Everything runs in your browser, so your secrets stay on your device.

How to use .env ↔ JSON Converter

  1. Pick the direction and paste your .env file or JSON object — conversion happens live.
  2. For .env → JSON, optionally infer numbers and booleans; parser warnings (bad lines, duplicates) appear below.
  3. For JSON → .env, toggle UPPER_SNAKE keys, the export prefix, and quoting — then copy or download the result.

Frequently asked questions

Are my secrets uploaded anywhere?
No — parsing is pure JavaScript running in your browser. Nothing is transmitted, logged, or stored.
How are comments and quoted values handled?
Full-line and trailing # comments are stripped, but a # inside quotes is kept. Single quotes are literal; double quotes support \\n, \\t and friends, including multiline values.
What happens to nested JSON when generating .env?
Nested objects flatten with underscores — {"db":{"host":…}} becomes DB_HOST. Arrays are embedded as JSON strings, since .env values are flat text.
Why are values strings in the JSON output by default?
Environment variables are always strings at runtime, so that is the faithful representation — enable "Infer numbers / booleans" when you want typed JSON instead.