What are JSON and .env?
JSON is the text format of web APIs: objects in braces, lists in brackets, strings always in double quotes, and nothing else. A .env file holds environment variables as KEY=value lines, one per line; frameworks and Docker load it into the process environment at startup.
The usual case is a JSON config or secret that must become environment variables for Docker, a CI job or a twelve-factor app.
This page opens the data converter already set to JSON → .env. Paste the text, read the result as you type, then copy it or download it as a file. Errors show the line and the column. Nothing is sent anywhere: the conversion runs in your browser.
JSON vs .env
| JSON | .env | |
|---|---|---|
| Extension | .json | .env |
| Media type | application/json | none (plain text) |
| Comments | no | yes (#) |
| Data types | string, number, true/false, null, object, array | text only |
| Nesting | any depth | none: flat keys |
| Typical use | APIs, package.json, logs | secrets and settings of apps, Docker, CI |
| Specification | RFC 8259 | convention (no formal spec) |
When to convert JSON to .env
- Convert to .env when the values go into environment variables of an app or a container.
- Keep JSON when another program or an API will read the data.
What changes in the conversion
- Nested keys are joined with
_and upper-cased (database.url→DATABASE_URL), list items get their index (FEATURES_0), and values with spaces or symbols are quoted.
How to convert JSON to .env
- Paste your JSON in the input box (the page opens with an example you can replace).
- Read the .env on the right; it updates as you type. If something is wrong, the message says the line and column.
- Adjust the options if you need: indentation, sorted keys or type detection.
- Copy the result or download it as a
.envfile.
Example
This JSON input:
{
"app": { "name": "orders", "port": 8080 },
"database": { "url": "postgres://db:5432/orders", "pool": 10 },
"features": ["pix", "boleto"]
}becomes this .env, exactly as the converter writes it:
APP_NAME=orders
APP_PORT=8080
DATABASE_URL=postgres://db:5432/orders
DATABASE_POOL=10
FEATURES_0=pix
FEATURES_1=boletoFrequently asked questions
Is my JSON sent to a server?
No. Conversion happens in your browser, so secrets in a config never leave your computer.
Does JSON to .env keep comments?
JSON has no comments, so there is nothing to lose. .env comments: yes (#).
What happens to nested data?
JSON nesting: any depth. .env nesting: none: flat keys. The tree is flattened into one key per value, as shown in the example.