Loona Automation logoLoona Developer Tools
Home › Data Converters

.env to JSON Converter

In short: paste a .env file and get its variables as a JSON object — export prefixes stripped, comments ignored, quoted values unquoted.
🔒 Private by design: everything runs in your browser on this device. Your input is never uploaded to a server.

Example

Input:

DB_HOST=localhost
# comment
PORT=5432

Output:

{
  "DB_HOST": "localhost",
  "PORT": "5432"
}

About this converter

The reverse trip: .env files drifting into documentation, audits and migrations are far easier to read as JSON. The parser follows the dotenv mainstream — KEY=value per line, optional export prefix, # comments (only at line start; a # inside an unquoted value is data to some parsers and a comment to others, so this parser keeps the dotenv behaviour of treating full-line comments only when they start the line, and inline comments after whitespace are stripped), single/double quotes unwrapped. All values stay strings, truthfully: .env never had types, and inventing them here would corrupt secrets that happen to look like numbers (a PIN of 0123 must not become 123).

Frequently Asked Questions

Why is PORT a string, not a number?

Because .env values are always strings; converting "0123" to 123 would corrupt data. Type at the application layer.

Does it expand $VARIABLES inside values?

No — expansion is shell/dotenv runtime behaviour with security implications; this parser shows you the literal file contents.

Related Developer Tools

Embed this tool on your website — free

Add this tool to your own website or blog — it is completely free, needs no sign-up, and always shows the latest version. Copy the code below and paste it into your page where you want the tool to appear. Keeping the small “Powered by Loona Automation” credit line under the embed helps keep this tool free — but you are free to style or remove it; the tool works either way.