Skip to content

ENV to JSON converter

Paste KEY=value lines. Values stay strings, and $ references are not expanded.

Every value is a string. true, false, and numbers are not converted, and $NAME or ${NAME} is rejected instead of expanded.

Ctrl+Enter or ⌘+Enter runs this tool immediately.

JSON output
ENV input
JSON output

Waiting for input.

Parsing stays in this browser. Input is not uploaded or saved.

How to use this tool

  1. Paste .env lines, or load the sample. A leading export and blank lines are accepted.
  2. Choose readable or compact JSON. The keys stay in the order they appear.
  3. Copy or download only when the status says the conversion succeeded.

Supported formats and limitations

  • Keys match [A-Za-z_][A-Za-z0-9_]*. A line without = is an error.
  • Values are always strings. 8080 and false are not turned into a number or a boolean.
  • Double quotes interpret only \\, \", and \\n. Other escapes are errors. Single quotes are literal.
  • A # outside quotes starts a comment. A # inside a quoted value is kept.
  • Duplicate keys are errors. The earlier value is not kept and the later value does not win.
  • $ interpolation is rejected. The tool does not read other variables or the process environment.

Examples

An export prefix

export is optional. The key is the name after it.

export PORT=8080

A quoted newline

\n inside double quotes becomes a newline character in the JSON string.

MESSAGE="line one\nline two"

Common errors and solutions

Duplicate key
Delete one of the assignments. The line number in the status is the second one.
Variable interpolation
Replace $NAME or ${NAME} with the literal text you want stored. This tool does not expand it.
Missing =
Write KEY=value. A key with no equals sign is not a blank value.

FAQ

Why is 8080 a string?
.env files do not carry types. The JSON keeps the characters you wrote, and the status says so.
Will $DATABASE_URL be filled in?
No. A dollar sign is an error so the output never pretends a variable was resolved.
Is the file uploaded?
No. Parsing happens in your browser. Do not paste secrets into a page you do not trust.

Read next

Related tools

  • ENV validator

    Check a .env file without converting it. Duplicate keys, missing equals signs, and $ references are errors, and the editor text is not rewritten.

  • JSON formatter

    Validate JSON, then pretty-print it with 2 or 4 spaces or minify it. Invalid JSON produces an error and leaves the output empty.

  • YAML to JSON converter

    Convert YAML configuration to readable or compact JSON in the browser. Comments are dropped, and parse errors include line and column when the parser reports them.