dotenv to JSON Converter

Convert a .env file to a JSON object and JSON back to .env, right in your browser. Your environment variables stay local.

The dotenv to JSON converter runs entirely in your browser. The .env files, JSON, and secrets you paste never leave your device and nothing is uploaded to ArrayKit.

Open the JSON Formatter

About dotenv to JSON

The dotenv to JSON converter reads a .env file — the KEY=value format that dotenv, docker-compose, and most 12-factor apps use — and turns it into a clean JSON object you can drop into a config, a secret manager, or a CI variable set. It understands single- and double-quoted values, ignores blank lines and '#' comments, strips an optional 'export ' prefix, and unescapes sequences like \n inside double quotes. Flip the toggle to go the other way and JSON becomes a valid .env file, with any value containing spaces or a '#' automatically double-quoted so it parses correctly. It is built for developers wiring up environments, rotating secrets, or reviewing what a config actually contains. Everything runs on your device — your environment variables never leave the browser.

Features

How to use the dotenv to JSON

  1. Keep '.env → JSON' selected and paste your .env file
  2. Copy the JSON object or download it as env.json
  3. Switch to 'JSON → .env' to reverse the conversion
  4. Paste a JSON object and copy the generated .env text

Example

Input

export PORT=3000
APP_NAME="My Service"
DEBUG=false # verbose

Output

{
  "PORT": "3000",
  "APP_NAME": "My Service",
  "DEBUG": "false"
}

The 'export ' prefix and inline comment are stripped; the quoted value is preserved.

Common errors & troubleshooting

Frequently asked questions

How does the dotenv to JSON converter handle quotes in a .env file?
Double-quoted values are unescaped (so \n becomes a newline) while single-quoted values are kept literal. Either kind lets a value hold spaces, '=', or '#' without being cut short. The surrounding quotes are removed in the JSON output.
What happens to comments and the export prefix when I convert .env to JSON?
Full-line '#' comments and blank lines are skipped, and an inline '# comment' after an unquoted value is dropped. A leading 'export ' on a key is stripped so the JSON key is just the variable name.
Why are all my values strings in the JSON output?
Environment variables are strings by definition — PORT=3000 is the text "3000", not the number 3000. The converter preserves that so the JSON matches exactly what process.env would return in your app.
How does JSON to .env decide when to add quotes?
Any value containing a space, '#', or a quote character is wrapped in double quotes, with special characters escaped, so the resulting .env line parses back to the original value. Simple tokens are left unquoted.
Can I convert a JSON config that has nested objects into a .env file?
A .env file is flat, so nested objects and arrays are JSON-stringified into a single quoted value. For a true flat file, flatten your JSON to top-level string values before converting.
Are my environment variables and secrets uploaded anywhere?
No. The dotenv to JSON converter runs entirely in your browser. The .env text and JSON you paste never leave your device and are not sent to ArrayKit or any server.

Related tools

All ArrayKit tools