Dotenv ⇄ JSON Converter
Parse .env files to JSON — quotes, comments, export prefixes and inline # all handled — and convert JSON back to .env with live key validation.
>_ USAGE GUIDE
Paste the contents of a .env file into the left panel and an order-preserving JSON object appears on the right immediately; paste JSON on the right to generate a standard .env file on the left. Everything runs locally in your browser, so environment variables that contain secrets never leave your device.
The parser is built for real-world .env files: full-line # comments, inline # comments in unquoted values, export FOO=bar prefixes, \n and \t escape expansion inside double quotes, and verbatim single-quoted values (POSIX semantics) — exactly the corners where dotenv libraries disagree with each other.
- Paste your .env: the JSON panel updates live, no button needed
- Check the warnings: invalid keys (such as names with hyphens) are listed per line and skipped, never silently dropped
- Generate in reverse: paste a flat JSON object and the
.envside emits properly quoted and escaped lines - Copy the result: use the copy button on each panel and drop it straight into your project
>_ FAQ
Q1 · Why were some keys skipped?
Keys must match [A-Za-z_][A-Za-z0-9_]* — starting with a letter or underscore, followed by letters, digits or underscores. A key like DB-HOST is not a valid environment variable name (the shell cannot export it), so the tool lists the offending line instead of guessing.
Q2 · What is the difference between double and single quotes?
POSIX shell semantics apply: inside double quotes, \n, \t, \\ and \" expand into real newline, tab, backslash and quote characters; inside single quotes everything stays verbatim, so \n remains a backslash followed by n. This is the number-one source of broken multiline secrets and regexes when moving shell config into .env files.
Q3 · How are inline # comments handled?
A # (hash preceded by a space) inside an unquoted value starts a comment and is stripped — DEBUG=true # dev flag keeps only true. A # inside single or double quotes belongs to the value itself and is preserved, matching mainstream dotenv implementations.
Q4 · Does JSON to .env support nested objects?
No, by design. .env is a flat set of string key-value pairs and there is no unambiguous mapping for nested structures. Only flat objects with string, number, boolean or null values are accepted; anything else is reported as an invalid key instead of being silently flattened.
Q5 · Is it safe to paste API keys?
Yes. Parsing and generation run entirely in your browser with zero network requests and no storage. That is precisely what makes the tool suitable for .env content — files that usually consist of real credentials.