tools/convert/.env ↔ json
// convertnew

.env ↔ json

convert .env files to json and back

// client-only ← enter .env or JSON
// .env
// JSON
← enter .env or JSON

// about this tool

.env files store environment variables as KEY=VALUE pairs, one per line. Lines starting with # are comments and blank lines are ignored. Values can optionally be wrapped in single or double quotes. This tool converts between .env text and JSON objects in both directions — useful for comparing environment configs, migrating to a secrets manager that speaks JSON, or seeding a local env from a JSON export.

// when to use

  • Convert a .env file exported from Vercel or Render into a JSON object for programmatic use
  • Seed a Docker Compose environment block by converting a JSON secrets export to .env format
  • Compare two .env files by converting both to JSON and using a diff tool
  • Generate a .env template from a JSON schema by converting example values

// faq

Are comments preserved in .env → JSON conversion?
No. Comments (lines starting with #) and blank lines are skipped during parsing — JSON has no comment syntax. In the reverse direction (JSON → .env) no comments are added either, since the tool only knows key/value pairs.
What happens to quoted values?
Both single-quoted and double-quoted values are unquoted during parsing: KEY="hello world" becomes {"KEY": "hello world"}. In the reverse direction, values containing spaces, # or = characters are automatically re-quoted with double quotes.
Does it support multi-line values?
No. Each line is treated as an independent key=value pair. Multi-line values (using escaped newlines or quoted newlines) are a non-standard extension not supported here. Flatten multi-line values to a single line before converting.
// history
Pro Cloud Sync — upgrade
no operations yet