Boneyard Tools

Convert .env to JSON and Back

Paste a .env file to turn its KEY=VALUE pairs into clean JSON, or paste JSON to build a .env file. Comments, blank lines, an optional export prefix and quoted values are all handled.

How to convert .env to JSON

  1. Paste your .env contents or your JSON into the box.
  2. Pick the direction: to JSON or to .env.
  3. Copy the converted result.

Examples

.env to JSON

# database
export DB_HOST=localhost
DB_URL="postgres://a=b@host"
{
  "DB_HOST": "localhost",
  "DB_URL": "postgres://a=b@host"
}

Frequently asked questions

Does it keep equals signs inside values?

Yes. Only the first equals sign on a line splits the key from the value, so connection strings and tokens that contain = stay intact.

Are comments and blank lines ignored?

Yes. Lines that are blank or start with # are skipped, so your JSON only contains real variables.

What about the export prefix and quotes?

An optional leading 'export ' is stripped, and surrounding single or double quotes are removed from values.

Will every value be a string?

Yes. Environment variables are always strings, so numbers and booleans are kept as quoted strings in the JSON output.

Is my data private?

Yes. The conversion runs entirely in your browser and nothing is uploaded.

Related tools