JSON to .env Converter
Convert JSON objects to dotenv key=value format and back. Nested keys are flattened with uppercase underscore convention.
OK
What Is JSON to .env Converter?
JSON to .env Converter transforms a JSON configuration object into dotenv-format key=value pairs, and converts .env files back to JSON. Nested objects are flattened using underscore-separated uppercase keys — the standard convention for environment variables.
How to Use
- Switch to JSON → .env mode and paste a JSON object to convert it to dotenv format
- Switch to .env → JSON mode and paste a .env file to parse it back to JSON
- Nested JSON keys are flattened with underscores:
db.host→DB_HOST - Copy the output with the Copy button
Features
- Bidirectional: JSON → .env and .env → JSON
- Nested object flattening with uppercase underscore keys
- Values with spaces or special characters are auto-quoted
- Comments (
#) in .env files are ignored during parsing
FAQ
How are nested objects handled?
Nested keys are joined with underscores and uppercased. For example, {"db": {"host": "localhost"}} becomes DB_HOST=localhost.
Are arrays supported?
Arrays are serialized as JSON strings in the .env value. When converting back, they are parsed as JSON.
Is this safe for secrets?
All processing runs in your browser — nothing is sent to any server. Still, avoid pasting real production secrets into any online tool.