JSON to .env
Paste or drop your data here, or open a file.
New to Bracely?
Everything stays in your browser.
Output appears here
Paste or open your data in the input box. It never leaves your browser.
JSON to .env
Apps that follow the twelve-factor style read settings from environment variables, while config often starts as JSON. Paste the JSON and get a .env file: nested keys joined into upper-case names and every value written so dotenv and the shell read it back unchanged.
Example: an app config for Docker
A nested config as JSON. Each key path becomes an upper-case name joined with _, the password with a space and @ is quoted, and the rest stay unquoted, so docker run --env-file and dotenv read every value back as it was:
Input
{
"app": {
"name": "bracely",
"port": 8080,
"debug": false
},
"db": {
"host": "localhost",
"user": "app",
"password": "p@ss word"
},
"redisUrl": "redis://localhost:6379/0"
}Output
APP_NAME=bracely
APP_PORT=8080
APP_DEBUG=false
DB_HOST=localhost
DB_USER=app
DB_PASSWORD='p@ss word'
REDIS_URL=redis://localhost:6379/0
How do I use the JSON to .env?
- Paste a JSON object, such as a config file.
- Pick how nested keys are joined (DB_HOST, DB__HOST or DB.HOST) and whether to add export.
- Copy the .env text or save it.
What does the JSON to .env do?
- Nested keys joined with _, __ or .
- Values quoted only when they need it
- Arrays and objects as JSON text, export lines optional
When to use the JSON to .env
Twelve-factor apps, Docker containers, Kubernetes deployments and serverless functions read their settings from environment variables, while configuration often begins as JSON. Converting it gives a .env file for docker run --env-file, Docker Compose's env_file, dotenv in Node and Python, or a CI system's variables.
Nested keys are joined into one name, DB_HOST by default, or DB__HOST, the double underscore that ASP.NET Core and many config libraries read back as nesting. Names are upper-case unless you keep their case. Values are quoted only when they need it, such as a password with a space or #, arrays and objects are written as JSON text, and export lines are optional. ENV to JSON, in the same tool, reads it back.
Frequently asked questions
- Which join should I use, _ or __?
- Use _ for names people read, like DB_HOST. Use __ when your app turns names back into nested settings: ASP.NET Core and libraries like Viper and convict read DB__HOST as db.host.
- Should I commit the .env file?
- No. A .env file usually holds secrets: keep it out of Git (add it to .gitignore) and commit a .env.example with the names and dummy values instead.
- Is my data uploaded?
- No. Bracely runs entirely in your browser, so nothing you paste or open leaves your device.
More JSON tools
Bracely has 104 JSON tools in one page. Related ones:
- Excel to JSON
- JSON to YAML
- JSON to CSV
- JSON to XML
- JSON to Excel
- YAML to JSON
- CSV to JSON
- XML to JSON
- JSON to TOML
- TOML to JSON
- JSON Lines / NDJSON
- JSON5 / JSONC to JSON
- JSON to SQL
- JSON to Markdown table
- JSON to ER diagram
- JSON Schema to TypeScript
- Remove duplicates
- Unix timestamp converter
- JSON Formatter
- JSON Validator
- JSON Viewer
- JSON Repair
- JSON Diff
- jq Playground
Runs entirely in your browser. Nothing you paste is uploaded. Made by Saurabh Pagrut · About · Privacy policy
Last updated · Version 6.1 · Changelog
Saurabh Pagrut on GitHub · LinkedIn · X · YouTube · Instagram