JSON to .env Converter
Convert a JSON object into .env lines.
- Objects are flattened recursively; booleans and numbers are never quoted unless quote mode is Always.
- Arrays are expanded to indexed keys or a single JSON string, depending on your choice.
- Everything runs locally in your browser — your JSON is never sent anywhere.
Runs in your browser. Nothing you open or type here is uploaded.
How to use
- Paste a JSON object into the input.
- Choose the nested-key separator, key case, quote mode and array handling.
- Click Convert.
- Copy the .env lines, or download them as a .env file.
Details
The tool flattens a JSON object into KEY=VALUE lines for a .env file. Nested objects are joined with the separator you pick — underscore, dot or double underscore — so {"database": {"host": "localhost"}} becomes DATABASE_HOST=localhost with the underscore separator and uppercase keys. Arrays either expand into indexed keys such as FEATURES_0 and FEATURES_1, or stay together as a single JSON-encoded value. With automatic quoting, a value is wrapped in double quotes only when it contains a space, a #, a quote or a newline, and inner double quotes are escaped.
- Booleans and numbers are never quoted, unless the quote mode is set to Always.
- Turn on Skip null values to leave null entries out of the output entirely.
- Download produces a ready .env file; the counter above the output shows how many variables were generated.
Common questions
How are nested keys converted?
Nested objects are flattened with your chosen separator. For example, {"database": {"host": "localhost"}} becomes DATABASE_HOST=localhost with the _ separator and UPPERCASE keys.
When are values quoted?
With Auto quoting, a value is wrapped in double quotes only when it contains spaces, a #, a quote, or a newline. Inner double quotes are escaped as \".
What happens to arrays?
Choose Indexed to emit FEATURES_0=auth, FEATURES_1=billing, or JSON to emit a single JSON-encoded value like FEATURES=["auth","billing"].