Convert .env files to a JSON object and flat JSON back to .env, handling quoted values, export prefixes and comments. Runs entirely in your browser, so secrets never leave it.
Updated
/ 5 - Be the first to rate this tool Thanks for rating!
Verification failed - please try again.
Quick check
Please verify you're not a robot to submit your rating.
Give feedback
Tell us what you think about Convert .env to JSON and JSON to .env.
- Runs entirely in your browser — your secrets are never sent to a server
- Handles quoted values, export prefixes, comments and blank lines
- Nested JSON is flagged with a clear inline error
How it works
-
1
Choose .env to JSON or JSON to .env.
-
2
Paste your file contents.
-
3
Correct any line the tool flags.
-
4
Copy the result.
About the .env ↔ JSON
A .env file keeps settings as KEY=value lines, while deployment dashboards, secret managers and some config tools want JSON. This converter reads .env syntax, including comments, export prefixes and quoted values, into a flat JSON object, and turns a flat JSON object back into .env lines, adding quotes only where a value needs them.
What you can do
- Convert .env to JSON and JSON to .env, with the result updating as you type.
- Skip blank lines and # comments, and accept lines that begin with export.
- Read double-quoted values with \n, \t and \" escapes, single-quoted values as literal text, and drop inline comments after unquoted values.
- Quote JSON values that contain spaces, quotes or special characters when writing .env lines.
- See the line number of any line that is not a valid KEY=value pair.
When it works best
- Moving variables from a local .env into a hosting provider or secret manager that imports JSON.
- Comparing two environments by converting both to JSON and diffing them.
- Generating a .env file from a JSON settings object produced by a script.
Things to know
- Conversion happens in your browser, but .env files usually hold secrets, so avoid pasting production credentials into any website.
- All values come out of .env as JSON strings; numbers and booleans are not detected.
- JSON to .env needs a flat object. Nested objects and arrays are rejected, and null becomes an empty value.
- Variable references like ${OTHER} are copied as text, not expanded. To compare two files, use Text Compare (Diff).
Frequently asked questions
No, every .env value becomes a string.
No. The object must be flat; nested objects and arrays are rejected.
No, they are copied as plain text.
Comments, export prefixes, double-quoted values with escapes, single-quoted literals and inline comments after unquoted values.