Toolstia / ENV file to JSON converter
.env file to JSON converter
Turn environment variable files into JSON and back. Comments, quotes, export prefixes and multi-line values are understood, and nested JSON can be flattened into names such as DB_HOST.
Comments, blank lines, export prefixes and quoted values are understood. If a name appears twice, the last value wins, as in most .env loaders.
How it works
- Choose the direction.
- Paste your .env file or JSON.
- Copy the result.
Reading .env files
Blank lines and # comments are skipped. Values can be bare, in single quotes (kept exactly) or in double quotes (with \n and \" escapes).
Types
By default every value stays text, like a real environment. Switch on type guessing to turn 3000 into a number and true into a boolean. Values like 007 stay text.
Writing .env files
Nested objects are flattened with underscores, names are capitalised and values with spaces or special characters are quoted for you.
Repeated names
If a name appears twice the last one wins, as in most loaders, and the tool tells you it happened.
Questions
Is it safe to paste secrets?
Everything happens in your browser, and nothing you enter is sent anywhere. Still, avoid pasting production secrets into any website.
Does it support variable expansion?
No. A value such as $HOME is left as written.
What about arrays?
Arrays are written as JSON text inside the value.