.env to JSON
Paste "API_KEY=abc123", "PORT=3000", a "# a comment" line and "DEBUG=true", then click ".env → JSON" to get {"API_KEY":"abc123","PORT":"3000","DEBUG":"true"} — the comment line is skipped, leaving 3 converted keys.
Convert .env files to JSON and JSON to .env variables instantly — free online converter.
About
Converts environment variables between the KEY=value lines of a .env file and a plain JSON object, in either direction.
Developers use it to turn a teammate's .env file into JSON for a config-loading script, or a JSON config back into .env lines for a deployment platform that expects that format. It's one of many free developer tools on Toolapt, and like every tool here, it's free to use with no sign-up and no limit on how many times you run it.
Examples
3 worked examples
Paste "API_KEY=abc123", "PORT=3000", a "# a comment" line and "DEBUG=true", then click ".env → JSON" to get {"API_KEY":"abc123","PORT":"3000","DEBUG":"true"} — the comment line is skipped, leaving 3 converted keys.
Paste {"HOST":"localhost","PORT":"8080"} into the JSON box and click "JSON → .env" to get HOST=localhost and PORT=8080 as two separate lines.
Paste "# database config" followed by "DB_NAME=app_prod" and convert to JSON to get {"DB_NAME":"app_prod"} — the comment line contributes nothing to the output.
FAQ
Quick answers to common questions about the .env / JSON Converter.
It converts environment variables between .env file format (KEY=value lines) and a JSON object, in either direction.
Yes. It's free, with no sign-up, no watermark and no limit on how many times you use it.
Yes, including secrets — everything is converted entirely on your own device, nothing is sent to a server.
Yes. Lines starting with # and blank lines are skipped when converting .env to JSON — only KEY=value lines are converted.
The tool shows an error message instead of converting, so you can fix the JSON before trying again.
No. Both formats represent a flat list of key/value pairs, so nested objects or arrays aren't supported as values.
Yes. The page is fully responsive and works on mobile, tablet and desktop browsers alike.
It's built for everyday flat environment-variable conversion; it doesn't validate variable names against any particular platform's rules.
Did .env / JSON Converter work for you?