🔧

JSON to .env

Flatten a JSON config into environment variables

🧑‍💻 Developer ToolsFreeRuns in your browser

.env output

—

Nested keys are flattened with underscores: api.url becomes API_URL. Values are escaped for .env syntax, and booleans and numbers are written as plain text.

About the JSON to .env

The JSON to .env Converter flattens a configuration object into environment variable lines. Nested keys become underscore-separated names, arrays are joined, and values are escaped for .env files.

Environment variables are flat by design, so nested config always needs a naming convention. Keep the mapping stable between local and production so a missing variable fails loudly instead of silently disabling a feature.

  • ✓Flattens nested keys
  • ✓Optional prefix and uppercase
  • ✓Skips null values on request

How to use the JSON to .env

  1. 1

    Paste a JSON object.

  2. 2

    Set a prefix and casing for the keys.

  3. 3

    Copy the generated .env lines.

Frequently asked questions

How are nested keys named?+

They are joined with underscores, so api.baseUrl becomes API_BASEURL. Rename keys first if you need cleaner names such as API_BASE_URL.

Can .env files hold arrays?+

Not natively. The tool joins arrays with commas, and your application code must split the value back into a list.

Save JSON to .env to your favorites, or keep browsing developer tools.

Browse all 35 developer tools →