TextArray
100% local

JSON to .env converter

Turn a JSON object into ready-to-use .env lines with clean uppercase keys.

Input
Output

JSON to .env converter

Paste a JSON object and this tool turns it into ready-to-use .env lines — one KEY="value" pair per line. It is the quickest way to move configuration out of a JSON app config, a secrets export or an API response and into environment variables for Docker, docker-compose, Node.js, Vite or any other tool that reads a dotenv file. It also saves the tedium of retyping every key by hand when you migrate a project from JSON-based configuration to environment variables.

Keys are converted to a safe env format automatically: accents are stripped, camelCase boundaries become underscores (apiKey turns into API_KEY), characters that are not letters, digits or underscores are replaced, and the result is uppercased by default — switch the checkbox off to keep the sanitized casing. Nested objects flatten into path-joined keys, so {"db":{"host":"x"}} becomes DB_HOST="x"; choose the JSON mode instead to keep each nested object as a single-line JSON string under its parent key. Arrays are always written as JSON strings, and the original key order is preserved.

Quoting is up to you: the default mode wraps every value in double quotes and escapes backslashes, quotes and newlines, while the "when needed" mode leaves simple values — numbers, booleans, plain hostnames and paths — bare. A null value becomes an empty variable.

API keys, database passwords and tokens are exactly the kind of data that should never touch someone else's server. This converter runs entirely in your browser: nothing is uploaded, nothing is logged, and your secrets never leave your device.

FAQ

How are nested objects and arrays handled?
By default nested objects flatten into underscore-joined keys, so {"db":{"host":"x"}} becomes DB_HOST. Switch to the JSON mode to keep a nested object as a single-line JSON string under its parent key. Arrays are always written as JSON strings.
What if two keys end up with the same name?
Both lines are kept in their original order. Most .env loaders take the last occurrence, so the later value wins when the file is read.
When are values quoted?
In the default mode every value is double-quoted, with backslashes, quotes and newlines escaped. In the "when needed" mode simple values such as numbers, booleans, hostnames and paths stay bare, and anything with spaces or special characters is quoted.
Are my API keys uploaded anywhere?
No. The tool runs entirely in your browser and your JSON never leaves your device, so it is safe to convert real secrets and production configuration.