Env JSON Converter
BetaTurn a .env file into a flat JSON object, or JSON back into KEY=value lines, in your browser. Values stay strings like process.env. Secrets are not uploaded.
- Free, no sign-up
- Updated
- Reviewed by Olgun Ozoktas
The .env text is converted in your browser and is not uploaded to FindUtils. Analytics and ads may load on the page.
The flat JSON object will appear here..
How to convert .env to JSON
-
Paste or upload the .env
Paste the file text into the left panel or upload the .env file. The three samples show a Node or Vite file with a duplicate key, a Docker Compose file, and a CI file where every line starts with export. -
Choose the options
Leave Infer types off to keep every value a string. Turn it on when a downstream schema expects numbers and booleans. Skip empty values leaves out keys with no value. -
Read the warnings
A duplicate key is listed with its line numbers and the note that the last value was used. A line without an equals sign stops the conversion and names the line, so nothing is silently dropped. -
Copy or download
Copy the JSON from the right panel or download it as env.json. Switch the direction to turn JSON back into a .env; the current output moves into the input so you can round-trip.
Common Use Cases
Secrets manager import
Test fixtures and typed config
Reading a long .env as data
JSON config back to dotenv
Why convert a .env file to JSON in the browser?
The dotenv format looks trivial and is not. A loader has to skip comments and blank lines, accept an optional export prefix, strip single or double quotes, apply backslash escapes inside double quotes only, let a double-quoted value run across several lines, cut an inline comment after an unquoted value, and decide what happens when a key appears twice. FindUtils' Env JSON Converter implements those rules and turns the result into a flat JSON object with one string per key, the same shape a Node process sees in process.env.
The page is deliberately browser-only. A .env file is the most sensitive text file in most projects, so nothing is sent to FindUtils and there is no REST or MCP surface for this tool. The Env Linter next door checks the same text for duplicate keys, unquoted spaces and drift against .env.example; this page changes its shape. For other config formats, the JSON YAML Converter, the JSON TOML Converter and the Properties JSON Converter follow the same two-pane pattern.
What the converter does not do is also part of the contract. It does not expand $VAR references, run command substitutions or parse shell grammar, because a .env file is not a shell script even when a shell can source it. It does not build a nested object from DB_HOST-style prefixes, because the file is flat and a guessed tree would be wrong for someone. And it does not upload anything, which is the reason it exists.
How it compares
Most env-to-JSON converters online post the text to a server and return the result, which is exactly the wrong design for a file full of credentials. Some run in the browser but invent a nested structure from underscores, or coerce every numeric-looking value into a number, so a port becomes an integer and a zero-padded id loses its zeros. FindUtils keeps values as strings by default, keeps the object flat, and reports duplicates instead of hiding them.
Compared with a one-line script, the page adds the parts people get wrong: multi-line quoted values, escapes, inline comments and the export prefix. Compared with the Env Linter, it converts instead of reporting. Use the linter to find the mistake and this page to move the data.
Dotenv Conversion Tips
- Keep Infer types off unless the consumer expects numbers. A dotenv loader gives every value to the process as a string, and "3000" and 3000 are different in JSON.
- A duplicate key is not an error in most loaders; the last value wins. The warning tells you which lines collided so you can remove the dead one.
- An unquoted # after a space starts a comment. Quote the value when it needs a literal hash, for example a colour or a URL fragment.
- Nested config is not invented. DB_HOST and DB_PORT stay two flat keys, because that is what the file says. Use a config library if you want a tree.
- Values that contain spaces, quotes, a hash or a newline are quoted on the way back to .env; everything else is written bare, the way people write these files.