What this tool converts
This tool parses standard .env-file syntax (KEY=value, one per line) into a JSON object. It skips blank lines and lines starting with # (comments), splits each line on the first = so values containing = signs are preserved, and strips a single layer of matching single or double quotes around the value.
It does not evaluate variable references (${OTHER_VAR}), multiline values, or export prefixes — each line is treated as a plain literal string, matching the behavior of the simplest .env parsers rather than a full shell-syntax implementation.
When to use it
Use it when you need to feed .env values into a system that expects JSON — a Node config loader, a CI pipeline's environment injection step, a Kubernetes ConfigMap generator, or documentation that shows both formats side by side. It's also useful for quickly reviewing a .env file's contents in a structured view instead of scanning raw KEY=value lines, especially when checking for accidental duplicate keys (the last one wins, matching real .env loader behavior).
For turning the same .env content into a docker-compose environment section instead of JSON, use the companion ENV to Docker Compose tool.
Example
Input DATABASE_URL=postgres://localhost:5432/app\nAPI_KEY="sk-test-123"\n# staging config\nDEBUG=true converts to {"DATABASE_URL": "postgres://localhost:5432/app", "API_KEY": "sk-test-123", "DEBUG": "true"} — the comment line is dropped, and the quotes around the API key are stripped, but DEBUG stays the string "true" rather than becoming a boolean.
How to use the ENV to JSON tool
- 1
Paste .env content
Standard KEY=value lines, one per line — comments (#) and blank lines are ignored automatically.
- 2
Click Convert
Each line is parsed into a key/value pair, with surrounding quotes stripped from values.
- 3
Copy the JSON
The output is pretty-printed JSON ready to paste into config files or scripts.
- 4
Share it
Copy a permalink to hand the exact .env content to a teammate — but see the privacy note below before sharing real secrets this way.
Frequently asked questions
Does it resolve variable references like ${OTHER_VAR}?
No — each value is treated as a literal string. If your .env file uses variable interpolation, the reference will appear verbatim in the JSON output rather than being resolved.
What happens with duplicate keys?
The last occurrence of a key wins and overwrites earlier ones, matching how most real .env loaders (dotenv, etc.) behave when a key is defined twice.
Are all values converted to strings?
Yes — .env files have no type system, so DEBUG=true becomes the JSON string "true", not the boolean true. Cast values explicitly in your code if you need actual booleans or numbers.
Is my .env content uploaded anywhere, and is the permalink safe to share?
Parsing runs entirely in your browser — nothing is sent to a server or logged. But the "Copy link" permalink encodes your full .env content into the URL itself so it can be restored later; if your input contains real API keys or credentials, treat that link as sensitive and don't post it anywhere public.
Related on TechLogHub
Related Converter Tools
Unix Timestamp Converter with Milliseconds
Convert Unix timestamps to human-readable dates and vice versa
ENV to Docker Compose
Convert .env files to docker-compose environment snippet
Query String to JSON
Parse URL query strings into JSON objects
JSON to Query String
Convert JSON objects to URL query strings
CSV to JSON Converter with Semicolon and Tab Delimiters
Convert CSV data to JSON array format
JSON to CSV Converter with Headers from Every Key
Convert JSON arrays to CSV format
Get the next tool before you need it
One email a week: new and trending developer tools, fresh comparisons, and what shipped. Unsubscribe in one click.

