.env ⇄ JSON
Convert a .env file into a JSON object and back again. Handles comments, quoted values and blank lines, so you can move configuration between formats without hand-editing.
About the .env ⇄ JSON
Environment variables configure apps without hard-coding secrets, and they live in .env files (KEY=value lines) or as JSON in many deployment platforms and CI systems. Moving between the two formats by hand is tedious and easy to get wrong with quoting and comments.
This converter parses KEY=value pairs — skipping comments and blank lines, respecting quotes — and emits clean JSON, or turns a flat JSON object back into .env lines. It runs entirely in your browser, so values that may be secret never leave your machine.
How to use it
- 1Choose the direction (.env → JSON or JSON → .env).
- 2Paste your .env file or JSON object.
- 3Copy the converted output.
Features
- Convert both directions: .env → JSON and JSON → .env
- Ignores comments and blank lines
- Handles quoted values and = inside values
- Configurable JSON indentation
- One-click copy of the result
Frequently asked questions
How do I convert a .env file to JSON?
Select the .env → JSON direction, paste your KEY=value lines, and a JSON object with those keys appears, ready to copy.
Does it handle comments and quotes?
Yes. Lines starting with # and blank lines are ignored, and single- or double-quoted values are unquoted correctly.
Is my configuration private?
Yes. Conversion is entirely client-side, so secrets in your .env or JSON never get uploaded.
Does it support nested JSON?
Environment variables are flat key/value pairs, so JSON → .env expects a flat object. Nested values are stringified.