What are .env and JSON?
A .env file holds environment variables as KEY=value lines, one per line; frameworks and Docker load it into the process environment at startup. JSON is the text format of web APIs: objects in braces, lists in brackets, strings always in double quotes, and nothing else.
Handy for loading a .env into a JSON-based secret store or a cloud console (AWS Secrets Manager, Vercel, Netlify), or for comparing two environments as data.
This page opens the data converter already set to .env → JSON. 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.
.env vs JSON
| .env | JSON | |
|---|---|---|
| Extension | .env | .json |
| Media type | none (plain text) | application/json |
| Comments | yes (#) | no |
| Data types | text only | string, number, true/false, null, object, array |
| Nesting | none: flat keys | any depth |
| Typical use | secrets and settings of apps, Docker, CI | APIs, package.json, logs |
| Specification | convention (no formal spec) | RFC 8259 |
When to convert .env to JSON
- Convert to JSON when another program or an API will read the data.
- Keep .env when the values go into environment variables of an app or a container.
What changes in the conversion
- Comments of the .env file are not carried over: the converter reads the data, and comments are not data.
- Every value is text (a
.envhas no numbers or booleans), quotes are removed,exportprefixes are accepted and keys keep their exact spelling.
How to convert .env to JSON
- Paste your .env in the input box (the page opens with an example you can replace).
- Read the JSON 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
.jsonfile.
Example
This .env input:
# orders service
APP_NAME=orders
APP_PORT=8080
DATABASE_URL=postgres://db:5432/orders
DATABASE_POOL=10
GREETING="Olá, mundo"becomes this JSON, exactly as the converter writes it:
{
"APP_NAME": "orders",
"APP_PORT": "8080",
"DATABASE_URL": "postgres://db:5432/orders",
"DATABASE_POOL": "10",
"GREETING": "Olá, mundo"
}Frequently asked questions
Is my .env sent to a server?
No. Conversion happens in your browser, so secrets in a config never leave your computer.
Does .env to JSON keep comments?
No. Comments are dropped because the converter works on the data itself. Copy important comments by hand; JSON itself has no comment syntax.
What happens to nested data?
.env nesting: none: flat keys. JSON nesting: any depth. The structure is kept as it is.