About the ENV to JSON Converter
This is a browser text tool that converts dotenv style KEY=VALUE lines to flat JSON objects and converts JSON back to .env lines. You can pick plain string output or enable a numbers and true/false mode that promotes unquoted numeric and boolean values. The tool runs entirely in your browser: nothing you paste or type is uploaded. You can copy the converted output with one click, open a local file to convert, and download the result. Developers use it for CI variables, Docker panels, serverless dashboards, and quick local edits. The tool focuses on predictable dotenv rules used by motdotla/dotenv and the dotenvx spec, and it shows the same basic behaviors you see in those implementations so you know what to expect when you move values into Node or container environments.
How to use it
- 1Paste or open a .env file or paste JSON in the input box.
- 2Choose a mode: .env to JSON, .env to JSON (numbers and true/false), or JSON to .env.
- 3Click Convert to see the result in the output panel.
- 4Click Copy to copy the result or click Download to save it to a file.
Worked example
Input (.env): # sample.env PORT=3000 DEBUG=true DB_PASS="pass#1" Converted JSON with numbers and true/false option: {"PORT":3000,"DEBUG":true,"DB_PASS":"pass#1"}
How it works
Text tool that runs in the browserOptions: .env to JSON, .env to JSON (numbers and true/false), JSON to .envOne click copies the outputVisitors can also open a file and download the resultNothing typed is uploadedSource: motdotla/dotenv READMEdotenvx spec. Last checked 6 November 2026.
What it is good for
- Runs client-side in your browser so text is not uploaded
- One-click copy and file download for fast handoff
- Optional numbers and true/false promotion for JSON consumers
- Produces flat JSON keys only; it does not create nested objects automatically
- Type promotion is opt-in and follows simple rules for unquoted values
Questions people ask
Does this tool send my .env contents to a server?
No. The conversion runs in your browser and nothing you paste or type is uploaded. You can open local files and download results without any network transfer.
Will values become numbers or booleans automatically?
By default values are treated as strings. Use the .env to JSON (numbers and true/false) option to promote unquoted numeric and true/false tokens to JSON numbers and booleans.
How does the tool handle quotes, escapes and comments?
It follows common dotenv rules: an export prefix is removed, single quotes are literal, double quotes allow backslash escapes and preserve embedded # characters, and unquoted values stop at an unescaped # which starts an inline comment.
What happens with duplicate keys in a .env file?
Most dotenv loaders use last occurrence wins. This converter follows common behavior where later assignments overwrite earlier ones. If you need to track duplicates, inspect the input and reorder or remove lines before converting.
Can values be multiline?
Double-quoted values can include embedded newlines in many dotenv implementations. If you paste multiline quoted values, the converter preserves them according to common dotenv parsing rules, but behavior can vary for unclosed quotes.
Are there regional differences I should worry about?
The .env and JSON formats do not change by geography. If your .env contains personal data, handle it under applicable laws like the EU GDPR when you store or share files.
Help keep every tool free
FreeToolr stays free because people help it grow. Share a tool you like, tell us what to build next, or support us on Ko-fi.