Category: Developer tools

JSON to dotenv

System ideaMissing a tool?

Convert a flat JSON object into .env format

Paste a flat JSON object and get .env-style KEY=value lines, with values quoted automatically when they contain spaces, quotes or other characters that need it. Runs entirely in your browser.

.env
PORT=3000
NODE_ENV=production
API_BASE_URL=https://api.example.com
FEATURE_FLAG_BETA=true

Everything on this page is processed in your browser. Nothing is uploaded.

Everything on this page is processed in your browser. Nothing is uploaded.

What this tool does

This is the reverse of parsing a .env file: it takes a flat JSON object and writes one KEY=value line per property, quoting a value whenever it's empty or contains whitespace, a quote character or a backslash so the result stays a valid .env file. Nested objects and arrays aren't representable as a single .env value, and keys have to look like valid environment variable names, so the tool reports exactly which key caused a problem instead of silently dropping it.

How to use it

  1. Paste a flat JSON object, or load the example.
  2. Copy the resulting .env lines.

Privacy

This tool runs entirely in your browser. Your input is never uploaded, stored or shared — closing the tab removes it.

Frequently asked questions

Is my JSON uploaded anywhere?
No. Conversion happens in JavaScript running in the page, so your data never leaves your device.
What happens with nested objects or arrays?
They're reported as an error naming the offending key, since a .env value has to be a single flat string, not a structure.
Which values get quoted?
Any value that's empty or contains whitespace, a quote character or a backslash; plain values like numbers or simple words are left unquoted.