appsettings.json ↔ Environment Variables Converter
Flatten appsettings.json into the Logging__LogLevel__Default double-underscore form ASP.NET Core reads from the environment, in five output formats, with likely secrets flagged — or reconstruct JSON from environment variables.
What this tool does
Paste an appsettings.json file to flatten it into the double-underscore environment variable form ASP.NET Core reads — as a plain .env file, docker-compose YAML, Azure App Service Application Settings JSON, or PowerShell $env: assignments. Switch to Env → JSON to go the other way: paste environment variable lines and reconstruct the nested JSON. Values that look like secrets are flagged with a warning. Everything runs in your Blazor Server session; nothing is sent to an external API.
This pairs with the appsettings.json Environment Diff tool — diff two config files first to catch missing keys, then use this tool to generate the environment variables for wherever you're actually deploying.
Why ASP.NET Core uses double underscores
ASP.NET Core's configuration system flattens nested JSON into colon-separated keys internally — Logging:LogLevel:Default. But : isn't a valid character in an environment variable name on every platform (notably some shells and Azure App Service's own settings UI), so the environment variable configuration provider uses __ (double underscore) as a portable stand-in, which it automatically converts back to : when binding. : does work directly as an env var name on Linux/macOS shells and in Docker — but __ works everywhere, which is why it's the form actually documented and recommended for cross-platform deployments.
Worked example
This appsettings.json:
{
"Logging": { "LogLevel": { "Default": "Information" } },
"AllowedHosts": [ "example.com", "www.example.com" ]
}
flattens to:
Logging__LogLevel__Default=Information
AllowedHosts__0=example.com
AllowedHosts__1=www.example.com
How to use this tool
- Pick a direction with the mode toggle, and pick your target format from the dropdown.
- JSON → Env: paste appsettings.json, click Convert. Review any secret warnings before copying.
- Env → JSON: paste environment variable lines in the selected format, click Convert.
Use this as an ASP.NET Core env variable converter for whatever you're deploying to: pick docker-compose to convert appsettings json to docker compose environment syntax, or Azure App Service for the portal's Application Settings format. Either way, the output uses the same double underscore configuration convention ASP.NET Core's environment variable provider expects.
appsettings.json
{
"Logging": { "LogLevel": { "Default": "Information" } },
"ConnectionStrings": { "Default": "Server=db;Database=app;User Id=sa;Password=hunter2;" },
"AllowedHosts": [ "example.com", "www.example.com" ]
}Plain KEY=value (.env)
Converted output
Logging__LogLevel__Default=Information ConnectionStrings__Default=Server=db;Database=app;User Id=sa;Password=hunter2; AllowedHosts__0=example.com AllowedHosts__1=www.example.com