---
title: "Env JSON Converter"
description: "Turn 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."
url: https://findutils.com/developers/env-json-converter/
category: developers
---

# Env JSON Converter

Turn 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.

**Use this tool:** [Env JSON Converter](https://findutils.com/developers/env-json-converter/)

## Programmatic access

- Browser-only: this tool works on a file, the DOM, or a browser API and has no REST or MCP id.

## Why convert a .env file to JSON in the browser?

A .env file is a list of secrets. The moment you need it as JSON, for a secrets manager import, a CI fixture, or a typed config check, the choices are to retype every KEY=VALUE pair by hand or to paste production credentials into a website that sends them to a server. This page does the conversion in the tab. It reads the file the way a dotenv loader does: comments, an export prefix, single and double quotes, backslash escapes, a double-quoted value that spans several lines, and duplicate keys where the last one wins. Every value stays a string, because that is what process.env holds; the Infer types switch promotes unquoted numbers and booleans only when you ask. The reverse direction writes KEY=value lines back and quotes only the values that need it.

## Frequently Asked Questions

### Is my .env uploaded anywhere?

No. The conversion runs in your browser and no request carries the text. This is why the tool has no REST or MCP version: the input is usually secrets, and the safest server is no server. Third-party analytics and ads may still load on the page, as on the rest of the site.

### Why are numbers and booleans quoted in the JSON?

Because a dotenv loader hands every value to the process as a string. PORT=3000 becomes "3000" in process.env, so the JSON says "3000" too. Turn on Infer types when the consumer expects real numbers and booleans; unquoted integers, decimals, true, false and null are then promoted, and quoted values stay strings.

### What happens to duplicate keys?

The last value wins, which is what most loaders do, and the key is listed under Warnings with every line number it appeared on. The JSON keeps the key in the position where it first appeared.

### Does it handle quotes, escapes and multi-line values?

Yes. Single quotes keep the value literal. Double quotes apply the escapes \n, \r, \t, \" and \\, and a double-quoted value may span several lines, which is how people store a PEM key in a .env. Unquoted values end at an inline # comment that follows a space.

### Does it expand $VAR or run commands?

No. The tool reads the dotenv format only. Variable expansion, command substitution and the rest of shell grammar are outside its scope, so a value like $HOME stays the literal text $HOME.

### Can it turn DB_HOST and DB_PORT into a nested db object?

No, on purpose. A .env file is flat, and a tree guessed from underscores is wrong for some file. The JSON stays flat with one key per line. If you need nested config, convert the flat object with your config library.

### What does the JSON to .env direction do with nested JSON?

It stops with the message that the root must be a flat object of scalars. Objects and arrays are not flattened into invented key names. Strings, numbers, booleans and null are accepted; null becomes an empty value.

### When are values quoted on the way back to .env?

Only when they need it: a value with whitespace, a hash, a quote character, a backslash or a newline is written in double quotes with escapes. Everything else is written bare. Turn on Quote every value if your loader prefers quotes everywhere, and export prefix if a shell will source the file.

### What does a line without an equals sign do?

It stops the conversion and names the line, for example Line 4: no "=" on this line. A converter that skipped the line would drop data silently. Fix or remove the line and convert again; comments and blank lines are fine.

### Is there a size limit?

The page accepts up to one million characters, far beyond any real .env. Conversion is instant for normal files because everything happens in the tab.

## Related Tools

- [Env Linter](https://findutils.com/developers/env-linter/)
- [JSON YAML Converter](https://findutils.com/developers/json-yaml-converter/)
- [JSON TOML Converter](https://findutils.com/developers/json-toml-converter/)
- [Properties JSON Converter](https://findutils.com/developers/properties-json-converter/)
- [JSON Formatter](https://findutils.com/developers/json-formatter/)
- [Cron to systemd](https://findutils.com/developers/cron-to-systemd/)
