Env to JSON
Read a .env file into JSON: export prefixes, quoted values, escapes and comments handled.
What .env to JSON does
Every value is a string, which is the honest shape — a process environment has no types, so PORT=3000 is "3000" and not 3000. An export prefix is accepted because a shell file often has one; a double-quoted value is unquoted with \", \\ and \n resolved inside it; a single-quoted value is literal, so $HOME stays four characters. Comments and blank lines are skipped. A name that is not a shell identifier — APP.PORT — is refused by name rather than guessed into APP_PORT.
How to use it
Env to JSON: paste the .env into the box above, and press Run to get the JSON below.
Worked example
Input:
# Deployment
NODE_ENV=production
export PORT=3000
DATABASE_URL="postgres://user:pass@db:5432/app"
MOTD='hello world'
Output:
{
"NODE_ENV": "production",
"PORT": "3000",
"DATABASE_URL": "postgres://user:pass@db:5432/app",
"MOTD": "hello world"
}
Why it runs in your browser
The conversion happens on this page with JavaScript. Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere. The page reads .env and returns JSON; reloading the page discards both.
Every value is a string, which is the honest shape — a process environment has no types, so `PORT=3000` is `"3000"` and not `3000`. An `export ` prefix is accepted because a shell file often has one; a double-quoted value is unquoted with `\"`, `\\` and `\n` resolved inside it; a single-quoted value is literal, so `$HOME` stays four characters. Comments and blank lines are skipped. A name that is not a shell identifier — `APP.PORT` — is refused by name rather than guessed into `APP_PORT`.
Read a .env file into JSON: export prefixes, quoted values, escapes and comments handled.
How to use it
Env to JSON: paste the .env into the box above, and press Run to get the JSON below.
Why it runs in your browser
The conversion happens on this page with JavaScript. Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere. The page reads .env and returns JSON; reloading the page discards both.
What to Expect
Best for
- Converting .env to JSON when the data is already on screen.
What this tool keeps
- Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere.
Sample input
# Deployment NODE_ENV=production export PORT=3000 DATABASE_URL="postgres://user:pass@db:5432/app" MOTD='hello world'
Sample output
{ "NODE_ENV": "production", "PORT": "3000", "DATABASE_URL": "postgres://user:pass@db:5432/app", "MOTD": "hello world" }
Frequently asked questions
How do I use the env to json?
Env to JSON: paste the .env into the box above, and press Run to get the JSON below.
Is my input uploaded?
No. The text is parsed on this page with JavaScript and is never posted to a server.
Is there a size limit?
Yes: 5 MB per run. Larger input is refused with a message rather than freezing the tab.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.