Skip to content

JSON to ENV

Convert a JSON or YAML object into .env lines of KEY=value. Nested keys are joined with a separator such as __, so {"db":{"host":"x"}} becomes DB__HOST=x, and arrays use their index. Values are quoted only when they need it, so the file loads correctly with dotenv and similar loaders.

Reset

Frequently asked questions

How are nested objects converted?

Keys along the path are joined with the separator you choose, two underscores by default. This matches the convention of ASP.NET Core configuration and many other tools that read nested settings from environment variables.

How are arrays handled?

Each item gets its index as a key part, so {"hosts":["a","b"]} becomes HOSTS__0=a and HOSTS__1=b.

When are values quoted?

Values made only of letters, digits and simple punctuation are written as they are. Values with spaces, quotes, #, $ or backslashes are put in single quotes, and values with a single quote or a line break in double quotes with \n and \" escapes.

What happens to characters that are not allowed in names?

Characters other than letters, digits and underscores, and dots when you choose the dot separator, are replaced with an underscore, and a name that starts with a digit gets a leading underscore.

What do the uppercase and prefix options do?

Uppercase writes names such as DB__HOST, the usual style for environment variables. A prefix such as APP_ is added in front of every name, which helps keep variables of one application together.

How are null and boolean values written?

Booleans and numbers are written as text, for example true or 5432. A null value becomes an empty value, such as KEY=.

About OneClick Pro

OneClick Pro is a free collection of more than 150 web tools for everyday work: converting images and units, formatting and validating code, checking domains and SEO, and working with text, dates and numbers. Every tool runs without registration or subscription, and what you enter is only used to calculate your result and is never stored. Use it as a quick toolbox for one-off tasks, or bookmark the tools you rely on every day.