appsettings.json to flat environment JSON
Convert appsettings.json to a flat JSON object of environment variables. Generate double-underscore names and string values, or rebuild nested settings locally.
Flat environment JSON is different from appsettings.json
This format creates a flat object whose property names are environment-variable names and whose values are strings. Logging:LogLevel:Default becomes Logging__LogLevel__Default. Use it when another tool expects a JSON map of variables. To rebuild nested appsettings.json, switch the conversion direction; type detection can restore numbers and booleans.
ENV → JSON detects the pasted format automatically. You can paste another supported format without changing this selection.
How .NET maps settings to environment variables
Logging__LogLevel__Default
Sections
Every level of nesting becomes a double underscore, because a colon does not work in environment variable names on every platform.
Cors__Origins__0
Arrays
Each item of an array gets its position as a key, starting at 0.
LOGGING__LOGLEVEL__DEFAULT
Overrides
.NET reads environment variables after appsettings.json, so they replace its values. Names are not case sensitive.
MYAPP_Jwt__Issuer
Prefix
With AddEnvironmentVariables("MYAPP_"), .NET reads only the variables that start with the prefix and drops the prefix from the name.