Free .env to JSON — type inference · quotes · comments

Convert .env to JSON
Parse dotenv files
to JSON instantly.

Parse any .env file to JSON. Handles quoted values, comments, numbers, booleans and JSON array values. Runs entirely in your browser.

Your data never leaves your browser
Handles quoted values + escapes
Type inference: int · float · bool · null
Always free
.env to JSON Parser   100% client-side
.env input
  JSON ready

      

.env parsing rules

How each .env line is parsed to a JSON value.

.env lineJSON outputNotes
HOST=localhost"HOST": "localhost"Unquoted string
PORT=5432"PORT": 5432Integer (type inference on)
DEBUG=true"DEBUG": trueBoolean
KEY="KEY": ""Empty value → empty string (same as dotenv)
MSG="hello world""MSG": "hello world"Quoted — spaces preserved, quotes stripped
TAGS=["a","b"]"TAGS": ["a", "b"]JSON array value parsed
# comment—Comment lines ignored
export KEY=val"KEY": "val"export prefix stripped

Multi-line values, export and other dotenv rules

The parser follows the same rules as dotenv: an optional export prefix is ignored, values in double, single or backtick quotes can span several lines, # starts a comment only outside quotes, and an empty value (KEY=) becomes an empty string. Numbers with leading zeros stay strings.

Other config formats: INI to JSON, TOML to JSON and YAML to JSON. To go back, use JSON to .env.

All data & config formats tools

.env parsed in your
browser. No upload.

The parser handles all standard dotenv formats: unquoted values, double-quoted and single-quoted strings with escape sequences, inline comments (stripped), blank lines (ignored), and the optional export prefix. Values that look like JSON arrays or objects are parsed as JSON.

Type inference

Numbers, booleans, null and JSON arrays are automatically typed — not everything is a string.

Quoted value support

Both double and single quoted values with escape sequences (\n, \t, \") are handled correctly.

All .env variants

.env, .env.local, .env.production, .env.development — any KEY=VALUE file works.

52 tools, always free

No watermarks, no account. Funded by non-intrusive display advertising only.

Frequently asked questions

How do I parse a .env file to JSON in Node.js?

Use dotenv: const result = require('dotenv').parse(require('fs').readFileSync('.env', 'utf8')). All values are returned as strings. For type inference, add your own post-processing or use this online tool and copy the typed JSON output.

How do I parse a .env file to JSON in Python?

from dotenv import dotenv_values; import json; config = dict(dotenv_values('.env')); print(json.dumps(config, indent=2)). python-dotenv returns all values as strings — use this tool for automatic type inference (numbers, booleans, null).

Is the .env to JSON converter free?

Yes, completely free. No account required.
Go up