Loona Automation logoLoona Developer Tools
Home › Data Converters

JSON to .env Converter

In short: flatten a JSON config object into .env lines — nested objects become PREFIX_KEY names, arrays become comma lists, and values are quoted exactly when .env syntax needs it.
🔒 Private by design: everything runs in your browser on this device. Your input is never uploaded to a server.

Example

Input:

{"db": {"host": "localhost"}, "port": 5432}

Output:

DB_HOST=localhost
PORT=5432

About this converter

.env files are the twelve-factor way to configure apps: flat KEY=value lines read by everything from Docker to Node's dotenv. Flattening JSON into that world needs conventions, stated here: nested objects join with underscores and uppercase (db.host → DB_HOST), arrays become comma-separated values, and values containing spaces, # or quotes are double-quoted with escapes, because an unquoted # starts a comment in most .env parsers and would silently truncate your secret. Booleans become true/false strings — .env has no types, and pretending otherwise is how "false" ends up truthy in a shell script.

Frequently Asked Questions

Why was my value quoted?

It contains a space, #, quote or $ that .env parsers would misread. The quotes keep the value intact.

Are the values typed?

No — .env is strings all the way down. Your application must parse "5432" into a number itself.

Related Developer Tools

Embed this tool on your website — free

Add this tool to your own website or blog — it is completely free, needs no sign-up, and always shows the latest version. Copy the code below and paste it into your page where you want the tool to appear. Keeping the small “Powered by Loona Automation” credit line under the embed helps keep this tool free — but you are free to style or remove it; the tool works either way.