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.

By Pankaj Kumar · DevToolsHub · Last updated Aug 2026

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

  1. Pick a direction with the mode toggle, and pick your target format from the dropdown.
  2. JSON → Env: paste appsettings.json, click Convert. Review any secret warnings before copying.
  3. 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.

This tool is built with ASP.NET Core 8, Blazor Server, and System.Text.Json.Nodes (no external YAML/dotenv library). It runs securely on Microsoft Azure.
Your input stays private. All processing happens in-memory on the server and is never stored, logged, or associated with your identity. Sensitive data — tokens, signing keys, and passwords — is safe to use here.
Input Section

appsettings.json

{
  "Logging": { "LogLevel": { "Default": "Information" } },
  "ConnectionStrings": { "Default": "Server=db;Database=app;User Id=sa;Password=hunter2;" },
  "AllowedHosts": [ "example.com", "www.example.com" ]
}
Output Section
4 variables1 possible secret
These look like secrets — don't commit them in a .env file or docker-compose.yml:
  • ConnectionStrings__Default

Put these in Azure Key Vault, .NET user secrets (dotnet user-secrets), or your CI/CD platform's secret store instead — never in source control.

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