JSON to ENV Converter
Turn a JSON config object into .env lines.
JSON
.env
About the JSON to ENV converter
Moving configuration from a JSON file into environment variables is the usual step when an application is containerised or deployed to a platform that only accepts environment settings.
Keys are upper-cased, nested objects are flattened, and values that would otherwise break parsing are quoted.
How nesting is flattened
Environment variables are flat, so `{"database": {"url": "..."}}` becomes `DATABASE_URL=...`. This underscore convention is what most twelve-factor configuration loaders expect, and several can reassemble the nesting from it.
Keys are upper-cased and any character that is not a letter, digit or underscore is replaced, since those are the only characters portable across shells.
Quoting
Values containing spaces, quotes, hashes or equals signs are wrapped in double quotes with the necessary escapes. Simple values are left bare, which keeps the file readable.
Frequently asked questions
What happens to arrays?
They are written as their JSON text, since environment variables hold only strings. Most loaders can parse that back if needed.
Is my data uploaded?
No. The conversion runs in your browser, which matters here — configuration files and spreadsheets routinely contain credentials and personal data.