Zero Signup ToolsFree browser tools

Converter Tools

Env to JSON Converter

Convert .env files to JSON and JSON back to .env in your browser. Handles quoted values, multi-line keys, comments, nested objects, and variable interpolation.

493 chars

Options

JSON indent

Value typing

Nested key handling

Variable handling

Parsed keys

Keys

11

Multi-line

1

Secret-shaped

3

Output bytes

441

KeyValueQuoted
NODE_ENVproductionbare
PORT8080bare
APP_NAMEMy App" "
DATABASE_URLpostgres://user:s3cr3t@db.example.com:5432/appbare
DATABASE_POOL_MAX20bare
DATABASE_SSLtruebare
JWT_SECRETsecretline1 line2" "
SESSION_TIMEOUTsecret3600bare
ALLOWED_ORIGINShttps://example.com,https://app.example.combare
PRIVATE_KEYsecret-----BEGIN RSA PRIVATE KEY----- MIIEow... -----END RSA PRIVATE KEY-----" "(multi-line)
LOG_LEVELinfobare

Lint warnings

No warnings. Input parsed cleanly.

.env reference: the parser matches the behavior of dotenv (Node), python-dotenv, and docker compose for normal lines. Quoted values support \n, \r, \t, \\, \" escapes.

Privacy: parsing and emitting both run in your browser. Nothing is uploaded.

Quick tips

Pasting into Vercel / Netlify

Use .env to JSON with Strings only typing. Most platform import forms expect every value to be a string, even if it looks like a number.

Nested config from .env

Pick Split on __ if your app uses double-underscore nesting (pydantic, NestJS, viper). The key DB__URL becomes { DB: { URL: ... } }.

Multi-line values

Wrap private keys, certificates, and JSON blobs in double quotes on the .env side. The parser captures everything until the closing quote, across lines. The emitter encodes newlines as \n so the value stays on one line.

Variable interpolation

Toggle Expand variables to resolve ${VAR} references in unquoted and double-quoted values. Single-quoted values stay literal, matching docker compose and python-dotenv behavior. Default-value (:-) and required (:?) syntax are supported.

How to use

  1. Pick a direction at the top: .env to JSON or JSON to .env. Click Swap direction to feed the current output back as the new input.
  2. Paste your file into the input box, or click Load sample to start with a realistic example that exercises quoted values, multi-line keys, comments, and nested configs.
  3. Adjust the options for your target system. For Vercel, Netlify, or AWS imports, use Strings only typing. For pydantic, NestJS, or viper apps, use Split on __ so DB__URL becomes nested.
  4. Read the live preview table to confirm every key and value parsed the way you expected. Toggle Mask likely secrets to hide values that look like API keys, tokens, or passwords.
  5. Click Copy output to copy the converted text. Use the lint warnings panel to spot duplicate keys, unterminated quotes, or invalid identifiers before deploying.

About this tool

Env to JSON Converter is a two-way converter between dotenv-style .env files and JSON. Paste a .env file and read back a JSON object you can drop into Vercel, Netlify, Render, Fly, AWS SSM, or any platform that imports a JSON config; or paste a JSON object and read back a portable .env file for docker compose, dotenv libraries, or CI secret bundles. The .env parser implements the practical subset that real tools and libraries use: KEY=value lines with optional `export ` prefix, double-quoted values with escape sequences (\n, \r, \t, \\, \", \$), single-quoted literal strings, unquoted values terminated by `#` comments, blank lines, end-of-line comments, multi-line values that span until the closing quote, and duplicate keys (last value wins, with a lint warning). Variable interpolation is supported as an opt-in toggle, including the bash forms ${VAR}, $VAR, ${VAR:-default}, ${VAR-default}, ${VAR:?required}, ${VAR?required}, ${VAR:+alt}, and ${VAR+alt}. The JSON to .env emitter handles nested objects (flatten with the double-underscore separator used by pydantic, NestJS, and viper, or keep as a JSON-encoded string), arrays (JSON-encoded or comma-separated for scalar-only lists), booleans, numbers, nulls (emitted as empty values), and strings (auto-quoted when they contain whitespace, hashes, dollars, backticks, or newlines). A live preview table shows each parsed key, its resolved value, and whether it was quoted; secret-shaped keys such as API_TOKEN, JWT_SECRET, and CLIENT_SECRET are flagged and can be masked for screenshots and screen-sharing. A lint panel surfaces invalid identifiers, duplicate keys, unterminated quotes, missing required interpolations, and sanitized key renames. Everything runs locally; your .env file and the secrets inside it never leave your device.

Free to use. Works in your browser. No signup, no login.

Related tools

You may also like

All tools
All toolsConverter Tools