.env ⇄ JSON
Convert a .env file to a JSON object and JSON back to .env locally, with quote and comment handling. Runs fully in your browser so secrets are never uploaded.
🔒 Runs entirely in your browser — nothing is uploadedWhat .env ⇄ JSON does
.env ⇄ JSON converts between the dotenv key-value format and a flat JSON object. The .env to JSON direction parses each line into a property, ignoring blank lines and comments that start with #, trimming surrounding whitespace, and stripping an optional export prefix. Values wrapped in single or double quotes are unquoted, and inside double quotes common escape sequences such as \n and \t are expanded so multi-line secrets and formatted values round-trip correctly. The JSON to .env direction walks a JSON object and writes one KEY=value line per property, quoting any value that contains spaces, line breaks, or characters that would otherwise be ambiguous to a dotenv parser.
This is handy when moving configuration between tools that expect different formats: importing a teammate's environment into a settings UI, generating a starter .env from a JSON config block, comparing variables across environments, or preparing a sample file for documentation. The converter focuses on the widely used dotenv conventions rather than any single library's extended syntax, so the output stays predictable and easy to review.
Private browser-based workflow
All parsing and serialization happen inside your browser with client-side JavaScript. The tool does not upload your environment file, JSON, hostnames, tokens, or credentials to a server, and it does not require an account. This local-only behavior is especially important here because .env files routinely hold database passwords, API keys, and signing secrets. Keeping the conversion on your machine means those values never leave the page, and there is no network round trip between paste and output.
The interface keeps source and output visible so you can confirm the conversion before copying it. Even though the work is local, remove real secrets before sharing any converted output in an issue, a chat, or documentation, and never commit a populated .env file to version control.
Practical tips
When converting JSON to .env, keep values as strings where the consuming application expects strings, since dotenv treats every value as text. Booleans, numbers, and nested objects are stringified, and nested objects are written as JSON so they survive the round trip; flatten them first if your loader cannot parse JSON values. When converting .env to JSON, duplicate keys resolve to the last assignment, mirroring how most dotenv loaders behave. Always validate the final configuration with the framework that will read it, because subtle quoting and interpolation rules differ between dotenv implementations.
How to use
- Choose directionSelect .env to JSON or JSON to .env before pasting your data.
- Convert locallyRun the converter and review parsing or validation messages.
- Copy or downloadCopy the output or download a .json or .env file.