.env to JSON Converter

Parse a dotenv file into a clean JSON object — privately in your browser.

Ad placeholder (leaderboard)
Enjoying the tools? Go Pro for £4.99 (one-time) and remove all ads — forever, on this device. Remove ads — £4.99

.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 export keyword is stripped, so export KEY=value becomes the key KEY.
  • The text up to the first = is the key; the rest is the value.
  • Double-quoted values are unquoted with \n and \" escapes processed; single-quoted values are kept literal.
  • With type coercion on, an unquoted true/false becomes 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.

Ad placeholder (rectangle)