.env ⇄ JSON Converter
Convert .env files to JSON and back — keys stay on your machine.
Convert a .env / dotenv file to JSON and back, free and in your browser. Paste a dotenv file, get clean JSON (or JSON back to .env) — keys never leave your…
About .env ⇄ JSON Converter
The .env ⇄ JSON Converter is a free, browser-based tool that turns a `.env` config file into a flat JSON object and converts a JSON object back into `.env` lines. It uses a dependency-free parser that understands `KEY=VALUE`, the optional `export` prefix, `#` comments, blank lines, and single/double quotes with escape handling — converting live as you type. Everything runs locally in your browser; your keys and secrets are never uploaded, and there is no signup.
How to use .env ⇄ JSON Converter
- Pick a direction with the segmented control at the top: '.env → JSON' or 'JSON → .env'.
- Paste your file into the left input box — a .env file in one direction, or a JSON object in the other. Conversion runs automatically as you type.
- For JSON → .env, optionally turn on 'Prefix with export' to emit `export KEY=VALUE` lines.
- Read the output on the right, and check the Pairs stat to confirm how many key/value pairs were produced.
- Watch for warnings: skipped .env lines are listed with line numbers, and invalid JSON or non-scalar values show an error instead of bad output.
- Click Download to save the result (env.json or .env), or use Copy — you can also select part of the output to copy just that.
Frequently asked questions
- Are my .env files or secrets uploaded to a server?
- No. All parsing and conversion happen entirely in your browser on your device — your keys and values are never uploaded or sent anywhere, which makes it safe for real secrets.
- Is it free and do I need an account?
- Yes, it's completely free with no signup, account, or watermark.
- What .env syntax does it understand?
- It handles KEY=VALUE pairs, an optional `export` prefix, full-line `#` comments, blank lines, and both single quotes (raw) and double quotes (with \n, \t, \" and \uXXXX escapes). Only `=` separates a key from its value, and when a key repeats the later value wins.
- What happens to malformed lines or invalid JSON?
- The .env → JSON direction is lenient: bad lines (no `=`, an empty key, or an invalid key name) are skipped and reported with their line numbers, not rejected. The JSON → .env direction is strict and shows an error if the input isn't valid JSON or isn't a flat object of scalar values.
- Can the JSON contain arrays or nested objects?
- No. JSON → .env requires a flat object whose values are strings, numbers, booleans, or null; arrays, nested objects, and non-finite numbers have no `.env` representation and trigger a clear error instead of garbage output. Values that need protecting (whitespace, quotes, `#`, or newlines) are automatically double-quoted and escaped so they round-trip cleanly.
- Is there a size limit on the input?
- Yes — input is capped at about 1 MB (1,000,000 characters) so per-keystroke conversion stays fast; past that the tool shows a warning and asks you to trim the input.
People also search for
.env ⇄ JSON Converter is also known as env to json converter, dotenv to json, json to .env file, convert dotenv file, env file converter online, parse .env to json.