Skip to content

JSON to ENV

Flatten a JSON config into .env lines with correct quoting and naming.

Quick Tool Overview

The JSON to ENV converter flattens a structured config into environment variables: nested keys joined with underscores and upper-cased, values quoted only where a shell needs it, and newlines escaped so each variable stays on one line.

What it does
Flattens JSON into .env lines
You give it
A JSON config object
You get back
One KEY=value per line, correctly quoted
Best for
Twelve-factor apps, Docker and CI secret stores
Developer Tools Free, unlimited use No sign-up Runs in your browser

About the JSON to ENV

Environments are flat and strings-only, so moving a structured config into one means flattening it. Nested keys are joined with underscores and upper-cased, giving the DB_POOL_SIZE shape every twelve-factor application expects.

Quoting is applied only where it is needed — a value containing spaces, a hash, a quote, a dollar sign or a backtick — because unnecessary quotes are noise and some loaders treat them as part of the value. Arrays become comma-joined lists by default, or indexed keys if you prefer. Newlines inside a value are escaped so the file stays one variable per line, which is the only form most loaders parse correctly.

Key features of the JSON to ENV

Twelve-factor naming

Nested keys become DB_POOL_SIZE — upper-cased and underscore-joined, the shape every environment expects.

Quoting only where needed

A value with a space, hash, quote, dollar or backtick is quoted; the rest are left bare, since a few loaders include stray quotes in the value.

Two array styles

Comma-join a list into one variable, or write one indexed variable per item.

One line per variable

Embedded newlines are escaped rather than written raw, because that is the only form most loaders parse.

Optional prefix

Add an APP_ or SERVICE_ prefix to every key in one field, which is how most platforms namespace config.

How to use the JSON to ENV

  1. 1

    Paste your JSON config

    Nested objects and arrays are both handled.

  2. 2

    Set the prefix and separator

    Add a prefix such as APP, and choose the character that joins nested keys.

  3. 3

    Choose how arrays are written

    Comma-joined into one variable, or one indexed variable per item.

  4. 4

    Copy the .env lines

    Paste them into your .env file or a deployment secret store.

Frequently asked questions

Because quotes are only needed when a value contains whitespace or a character the shell would interpret. Quoting everything is noise, and a few loaders include the quotes in the value.

Reviews of the JSON to ENV

What people who use the JSON to ENV think of it. Reviews come from visitors and are posted as written.

No ratings yet

Yours would be the first.

  • 5 0 reviews rated 5 stars
  • 4 0 reviews rated 4 stars
  • 3 0 reviews rated 3 stars
  • 2 0 reviews rated 2 stars
  • 1 0 reviews rated 1 star

Write a review

Used this tool? Your rating helps the next person decide.

Your rating

Plain text only — links, email addresses and HTML are not accepted. Your name and review are shown publicly; nothing else is collected. See the privacy policy.

0 reviews

Newest first

No reviews yet

Be the first to rate the JSON to ENV. It takes half a minute and no account.

Write the first review

More developer tools