When you'd use this
Mostly to move environment variables between formats that aren't .env. Postman and Insomnia store environments as JSON, so converting is how you get a .env in or out of an API collection. Secrets managers — AWS Secrets Manager, GCP Secret Manager, Doppler — store secrets as JSON, so you convert to seed them or to pull a blob back down into a local .env. Some CI/hosting platforms and Kubernetes ConfigMaps also take JSON. The JSON → .env direction (shown first) is the common one: turn a JSON blob from one of those into a working .env.
JSON → .env
Each property of a JSON object becomes a KEY=VALUE line. Values that contain spaces, #, newlines or quotes are wrapped in double quotes and escaped; plain values are written bare. Nested objects or arrays are serialised to a single-quoted JSON string so the line stays valid. The input must be a flat-ish JSON object.
.env → JSON
Each KEY=VALUE line becomes a JSON property. Blank lines and lines starting with # are skipped, a leading export is ignored, and surrounding quotes are removed — double quotes allow escapes like \n, single quotes are taken literally. Values stay as strings, because that's what environment variables always are: DEBUG=true becomes "true", not a boolean.
Notes
This follows common dotenv behaviour but isn't tied to one library's every quirk — review the output before committing a generated file. To validate or pretty-print the JSON side, use the JSON formatter; for other config formats try YAML ↔ JSON or CSV ↔ JSON.
Privacy
Conversion runs entirely in your browser — nothing you paste is uploaded. Handy, since .env files hold secrets.