.env to JSON converter
Configuration usually lives in a .env file as flat KEY=value lines, but many tools — serverless platforms, CI pipelines, config loaders and scripts — want structured JSON instead. This converter parses a dotenv file into a clean JSON object in your browser. Because env files frequently contain secrets, nothing is ever uploaded.
How it works
The parser reads your input line by line:
- Blank lines and lines starting with
#are ignored as comments. - An optional leading
exportkeyword is stripped, soexport KEY=valuebecomes the keyKEY. - The text up to the first
=is the key; the rest is the value. - Double-quoted values are unquoted with
\nand\"escapes processed; single-quoted values are kept literal. - With type coercion on, an unquoted
true/falsebecomes a boolean and a plain numeric string becomes a number. With it off, every value stays a string — which is how dotenv loaders actually behave at runtime.
Example
Input:
# database
export DB_HOST="localhost"
DB_PORT=5432
DEBUG=true
NAME='Jane Doe'
With type coercion on, the output is:
{
"DB_HOST": "localhost",
"DB_PORT": 5432,
"DEBUG": true,
"NAME": "Jane Doe"
}
Note DB_PORT became a number and DEBUG a boolean. The whole conversion runs in your browser — your env file never leaves your device.