loot.tools

Env to JSON Converter

Paste a .env file to get a JSON object, or paste JSON to get .env lines. Comments, export prefixes, and single- or double-quoted values are handled, and you can infer numbers and booleans on the way to JSON. Everything runs in your browser - your secrets never leave the page.

Convert a .env file to JSON or turn a JSON object back into .env lines. Comments, export prefixes, and single- or double-quoted values are all handled, and nothing leaves your browser.

.env Input
JSON Output

What this tool does

It moves config between a .env file and JSON without a server round-trip. Going to JSON, each KEY=VALUE pair becomes a property, comments and blank lines are skipped, and quoted values are unwrapped (double quotes honor \n and \t escapes, single quotes stay literal). Going back to .env, each property becomes a line, and values with spaces or special characters get quoted automatically.

Why you'd use this

Plenty of tools want config as JSON while your app reads a .env file - CI secrets, serverless dashboards, and Docker setups all do it differently. Instead of reformatting by hand, paste the file and copy the other shape. It's handy for seeding a secrets manager, diffing two environments, or generating a .env from a config object.

Types, quotes, and comments

An optional `export` prefix is stripped, and a trailing ` # comment` on an unquoted value is dropped. Turn on "Infer numbers & booleans" when going to JSON to convert values like 3000, true, and null into real JSON types instead of strings. Going to .env, arrays and objects are written as compact JSON strings, and you can uppercase keys to match the SCREAMING_SNAKE_CASE convention.