.env · transform

JSON to ENV

Turn JSON objects into valid .env files. Flattens nested keys automatically with configurable separators.

Be the first to rate
DATABASE_URL=postgres://user:pass@localhost:5432/db
PORT=3000
DEBUG=true
STRIPE_SECRET_KEY=sk_test_xxx
STRIPE_WEBHOOK=whsec_xxx

What it does

  • Converts any JSON object into a valid .env file
  • Flattens nested keys with configurable separator
  • Uppercases keys and sanitizes invalid characters
  • Copy or download the result
  • Works offline — 100% client-side

Privacy

Runs 100% in your browser. Your .env never touches our servers.

client-side only

Usage examples

Case 1 · Flat JSON
{
  "DATABASE_URL": "postgres://...",
  "PORT": 3000
}
DATABASE_URL=postgres://...
PORT=3000
Case 2 · Nested → flattened
{
  "database": { "url": "postgres://..." },
  "auth": { "jwt_secret": "xyz" }
}
DATABASE_URL=postgres://...
AUTH_JWT_SECRET=xyz
Case 3 · Arrays get stringified
{
  "ALLOWED_ORIGINS": ["http://localhost:3000", "http://localhost:5173"]
}
ALLOWED_ORIGINS=["http://localhost:3000","http://localhost:5173"]

When to use this tool

  • Migrating from a JSON config file to a .env
  • Exporting GitHub/GitLab Secrets as JSON and converting to .env
  • Bootstrapping local setup from a Vercel/Netlify export
  • Converting Firebase functions:config:get output to a .env

Common mistakes

  • Expecting arrays to survive — JSON arrays become stringified since .env values are strings
  • Losing type information: booleans and numbers become strings after flattening
  • Trusting the generated key names — double-check the casing matches your app's expectations
  • Forgetting to git-ignore the generated .env

Convert JSON to .env

Paste a JSON object and get a .env file back. The json-to-env converter flattens nested keys automatically so { "db": { "url": "..." } } becomes DB_URL=.... Useful for migrating configs, generating env files from GitHub Secrets exports, or bootstrapping local setup.

Related tools

Learn more

Compare

coming soon

Get notified when env syncing launches

We're building a tiny tool to keep .env files in sync across teammates and environments. Leave your email — no spam, just a single launch ping.