LazyTools

🔒 Every tool runs in your browser — the files and values you enter are never uploaded to any server. How it works

🗝️ JSON to .env Converter

Paste a JSON object and get a .env file: each property becomes a KEY=value line, quoted when it needs to be.

flat keys → KEY=value lines

Rate this tool:
Anonymous — no account, no identifier

How the json to .env converter works

The tool parses your JSON object and writes one KEY=value line per property. Values that are safe (no spaces, quotes, #, = or newlines) are written bare; anything else is wrapped in double quotes with its special characters escaped, so the file re-parses correctly. Numbers and booleans are written as their text form. The JSON must be a flat object — environment variables are a flat namespace — so nested objects are serialized to JSON strings rather than expanded.

This helps you turn a configuration object into a .env file for Docker, a CI secret store, or local development. Because dotenv variables are a flat list, keep your JSON one level deep for a clean file. As with any environment file, the values are often secrets — this runs entirely in your browser so nothing is uploaded, and you should store the resulting .env securely and keep it out of version control.

Frequently asked questions

How do I convert JSON to a .env file?

Paste a flat JSON object or load a .json file and the tool outputs KEY=value lines. Copy the result or download it as a .env file for your app, Docker or CI.

When are values quoted?

A value is wrapped in double quotes when it contains a space, quote, #, =, or newline — otherwise it's written bare. Special characters inside quotes are escaped so the line parses back to the same value.

What happens to nested objects or arrays?

Environment variables are a flat namespace, so a nested object or array is serialized to a JSON string and stored as one quoted value. For a clean .env, keep the JSON one level deep.

Are the keys changed?

No — property names are used verbatim as the variable names. If you follow the usual convention of UPPER_SNAKE_CASE keys in your JSON, that's exactly what you'll get in the .env.

Is my JSON uploaded?

No — everything runs locally in your browser, which matters because .env files typically hold secrets. Nothing is transmitted and it works offline.

Related file converters