Skip to main content
NeatUtility

.env to JSON Converter

YAML, TOML & ConfigMemory Only100% Client-Side
Ready
DOTENV
0 lines0 chars
0 B / 1.91 MB
About this tool, examples & FAQ

Convert between dotenv-style assignments and flat JSON objects with a documented subset parser, entirely in your browser. Quoted, single-quoted, and unquoted values are supported with a small escape set; there is no variable or command interpolation, comments do not round-trip, and prototype keys are rejected.

Key facts

Verified capabilities and limits of this utility
Accepted input.env assignment text for env-to-JSON; a flat JSON object for json-to-env
Supported valuesDouble-quoted, single-quoted, and unquoted values with newline, carriage-return, tab, quote, and backslash escapes
Dialect subsetFull-line and unquoted inline comments, export prefixes, and duplicate last-wins; no interpolation, no multiline values
Max input size2 MB
Execution deadline2 s
Processing locationBrowser-only sensitive handling: inputs and results stay in memory, never in persistent storage

How to use

  1. Choose your operation: '.env → JSON' or 'JSON → .env'.
  2. Paste your configuration content into the input pane.
  3. Configure quote formatting, 'export ' prefixes, key sorting, or number and boolean parsing.
  4. Click 'Run' to convert.
  5. Copy or download your configuration.

Examples

Parse .env with typed values

Input

NAME="Ada"
EMPTY=
ENABLED=true

Example output

{
  "NAME": "Ada",
  "EMPTY": "",
  "ENABLED": true
}

Convert flat JSON to .env

Input

{"NAME":"Ada","EMPTY":"","ENABLED":"true"}

Example output

NAME=Ada
EMPTY=""
ENABLED=true

Edge cases

No interpolation

Variable references and command substitutions are kept as literal text. The parser implements a dotenv subset and never expands values.

Comments do not round-trip

Full-line comments are skipped and unquoted inline comments are stripped, so converting back to .env will not restore them.

Multiline values are rejected

A quote opened on one line must close on the same line; unterminated quoted values fail with a line-numbered error instead of reading further lines.

Prototype and nested shapes are refused

Keys such as __proto__, constructor, and prototype are rejected, reverse conversion requires a flat object, and duplicate keys resolve last-wins with a warning.

Quoted value with trailing comment

KEY="a" # c is not treated as a quoted value with a comment; the comment is stripped but the surrounding quotes are kept literally. Remove the comment or use an unquoted value when you need comment stripping.

Never-quote flattens newlines

With quoteStyle none, embedded CR/LF are replaced with spaces rather than escaped; use auto or always to preserve them as \n escapes.

How it works

  1. Splits .env input into lines, skipping blanks and full-line comments and stripping an optional export prefix.
  2. Validates each key against the letter-underscore-alphanumeric shape and rejects prototype keys.
  3. Unescapes quoted values or, for unquoted values, strips inline comments and optionally coerces booleans and numbers.
  4. For reverse conversion, validates flat JSON and formats each value per the selected quote style inside a Web Worker bounded by the tool deadline.

Frequently asked questions

When do values become strings versus JSON types?

Quoted values always stay strings. Unquoted true, false, and numeric strings become native JSON types only when number and boolean parsing is enabled; otherwise everything converts as a string.

How do single, double, and missing quotes differ?

Double quotes support backslash escapes for newlines, tabs, quotes, and backslashes; single quotes are literal; unquoted values allow trailing inline comments. Reverse conversion quotes values automatically when they contain spaces, hashes, quotes, or equals signs.

Are comments preserved?

No. Full-line comments are ignored and unquoted inline comments are stripped during parsing, so comments are lost on conversion to JSON and never regenerated.

Are multiline values supported?

No. Values must fit on one line: an unterminated quote produces an error naming the line. Split long values or pre-join them before converting.

Are my secrets stored or logged?

No. The tool is marked sensitive, so inputs and results stay in memory and are not written to browser storage, URLs, or a processing server. Copying, downloading, or handing results to another tool are explicit actions you control. Successful conversion says nothing about whether the output is safe to source in a shell.

References