Skip to content
~/sailesh-rijal
C# / .NET · ASP.NET Core Configuration Builder

C# appsettings.json Generator

Build ASP.NET Core configuration files visually and generate appsettings.json, environment variables, Docker configuration, Kubernetes configuration and C# configuration classes. Pick sections, fill in values, and everything updates instantly — free, fast, and privacy-first. It all runs locally in your browser.

19 sectionsEnv vars (__)Docker & KubernetesC# options classesIOptions patternImport & export

Runs 100% in your browser — your data is never uploaded to a server.

Each property under ConnectionStrings is a named connection string. Read it with builder.Configuration.GetConnectionString("DefaultConnection").

Sensitive value — masked here. Development examples only; supply the real value from a secret store before production.

LogLevel maps a category (namespace) to a minimum level: Trace, Debug, Information, Warning, Error, Critical, or None. Add your own namespaces as needed.

These values are just configuration. Adding a Jwt section does not enable authentication — you still call AddAuthentication().AddJwtBearer(...) and read these values in code.

The signing key is a secret. Leave it blank here and supply it from environment variables, User Secrets, or a key vault — never commit a production key.

Sensitive value — masked here. Development examples only; supply the real value from a secret store before production.

AllowedHosts is a semicolon-separated list of host names the app will serve, or "*" for any host. It is enforced by the Host Filtering middleware — it is not the same as CORS.

+ Add configuration section or preset

Quick start presets

Presets replace the current configuration. Secrets are always left blank.

Core

Security & Auth

Caching & Messaging

Integrations

Observability

Custom

appsettings.jsonjson
17 lines375 chars
Valid configuration structure

Your configuration stays in your browser. SR Tools does not upload, store, or process it on a server — including passwords, keys, and connection strings.

Building a database connection string? Use the Connection String Builder. Turning JSON into models? Try the JSON to C# Converter, decode tokens with the JWT Decoder, or format JSON with the JSON Formatter.

What Is appsettings.json?

appsettings.json is the default configuration file for an ASP.NET Core application. When the host starts, it registers this file as a configuration source, so its contents become available through IConfiguration and the strongly typed options pattern. It holds framework settings such as Logging and AllowedHosts, your ConnectionStrings, and any custom sections your application defines.

It is standard JSON: objects, arrays, strings, numbers, booleans, and null, indented with two spaces. JSON does not support comments or trailing commas, so this generator never emits them.

How to Generate an appsettings.json File

  1. Pick a preset (API, SQL Server, JWT, Microservice…) or add individual sections.
  2. Edit keys and values inline. Sensitive fields (passwords, keys, secrets) are masked automatically.
  3. Watch the appsettings.json output regenerate live on the right, with structural validation.
  4. Switch output tabs to get environment variables, Docker, Kubernetes, and C# options classes with registration code.
  5. Copy or download any output, or Import JSON to load an existing file into the builder.

ASP.NET Core appsettings.json Example

A typical Web API configuration looks like this:

appsettings.json
{
  "ConnectionStrings": {
    "DefaultConnection": "Server=localhost;Database=MyDb;User Id=sa;Password=;TrustServerCertificate=True;"
  },
  "Jwt": {
    "Issuer": "https://localhost:5001",
    "Audience": "my-api"
  },
  "Redis": {
    "ConnectionString": "localhost:6379"
  },
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*"
}

ConnectionStrings holds named database strings; Jwt and Redis are custom sections your code binds and reads; Logging sets per-namespace log levels; and AllowedHosts is enforced by the Host Filtering middleware.

Connection Strings in appsettings.json

Connection strings live under the ConnectionStrings object, keyed by name:

ConnectionStrings
{
  "ConnectionStrings": {
    "DefaultConnection": "Server=localhost;Database=MyDb;..."
  }
}

Read a named string with the dedicated helper:

Program.cs
var connectionString =
    builder.Configuration.GetConnectionString("DefaultConnection");

builder.Services.AddDbContext<AppDbContext>(options =>
    options.UseSqlServer(connectionString));

Need to assemble the string itself? The Connection String Builder covers SQL Server, PostgreSQL, MySQL, and more.

JWT Configuration in appsettings.json

Store non-secret JWT values in a Jwt section and bind them to an options class. The signing key is a secret — leave it blank in the file and supply it from environment variables or a key vault.

Jwt
{
  "Jwt": {
    "Key": "",
    "Issuer": "https://localhost:5001",
    "Audience": "my-api",
    "AccessTokenExpirationMinutes": 60
  }
}

Adding this section does not enable authentication. You still call AddAuthentication().AddJwtBearer(...) in code and read these values there. Binding to a class is described under strongly typed configuration.

Redis Configuration

A Redis section usually stores a connection string and an instance name prefix:

Redis
{
  "Redis": {
    "ConnectionString": "localhost:6379",
    "InstanceName": "MyApp:"
  }
}

appsettings only stores these values. You still register the client (for example AddStackExchangeRedisCache or a ConnectionMultiplexer) and pass the connection string in code.

RabbitMQ Configuration

Store broker connection details and read them when building a ConnectionFactory:

RabbitMQ
{
  "RabbitMQ": {
    "Host": "localhost",
    "Port": 5672,
    "Username": "guest",
    "Password": "guest",
    "VirtualHost": "/"
  }
}

Configuration alone does not open a connection — your code consumes these settings. Do not ship the default guest/guest credentials to production; the built-in guest user can only connect from localhost anyway.

CORS Configuration

A common pattern is to store allowed origins in configuration and read them when adding a CORS policy:

Cors
{
  "Cors": {
    "AllowedOrigins": [ "https://example.com", "https://app.example.com" ],
    "AllowCredentials": true
  }
}
Program.cs
var origins = builder.Configuration
    .GetSection("Cors:AllowedOrigins").Get<string[]>() ?? [];

builder.Services.AddCors(o => o.AddDefaultPolicy(p =>
    p.WithOrigins(origins).AllowAnyHeader().AllowAnyMethod()));

ASP.NET Core does not enable CORS from arbitrary JSON — you wire it up in code. Never combine AllowAnyOrigin with credentials; list trusted origins explicitly. Note that AllowedHosts (host filtering) is a different feature from CORS.

Environment Variables in ASP.NET Core

ASP.NET Core reads environment variables as a configuration source that overrides appsettings.json. Hierarchy is expressed with a double underscore (__) because : is not valid in environment-variable names on all platforms:

Mapping
Jwt:Issuer                         ->  Jwt__Issuer
Jwt:Key                            ->  Jwt__Key
ConnectionStrings:DefaultConnection ->  ConnectionStrings__DefaultConnection

The generator's Environment Variables tab produces this mapping in .env, Bash, PowerShell, Docker Compose, and Kubernetes formats — masking secrets as ${PLACEHOLDER}by default so you don't leak real values.

appsettings.json and Docker

You can bake appsettings.json into your image, but sensitive values are better injected at runtime as environment variables. In Docker Compose:

docker-compose.yml
services:
  api:
    image: myapp:latest
    environment:
      ASPNETCORE_ENVIRONMENT: Production
      ConnectionStrings__DefaultConnection: ${DATABASE_CONNECTION}
      Jwt__Key: ${JWT_KEY}

Prefer ${VAR} references (resolved from the host or an .env file) for secrets rather than committing them into the compose file.

appsettings.json and Kubernetes

Split configuration by sensitivity: non-secret values into a ConfigMap, secrets into a Secret, both keyed with __ so they map to configuration hierarchy. Mount them with envFrom.

configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: myapp-config
data:
  Jwt__Issuer: "https://localhost:5001"
  AllowedHosts: "*"

Kubernetes Secrets are only base64-encoded by default. Whether they are encrypted at rest depends on your cluster configuration, so treat the generated manifest as a template and manage real secrets through a secret manager.

Strongly Typed Configuration in ASP.NET Core

Instead of reading magic strings everywhere, bind a section to a class:

JwtOptions.cs
public sealed class JwtOptions
{
    public string Key { get; set; } = string.Empty;
    public string Issuer { get; set; } = string.Empty;
    public string Audience { get; set; } = string.Empty;
    public int AccessTokenExpirationMinutes { get; set; }
}
Program.cs
builder.Services.Configure<JwtOptions>(
    builder.Configuration.GetSection("Jwt"));

The C# Code tab generates this class, the registration, and an IOptions usage example from your actual configuration — inferring property types and honoring nullable reference types.

IOptions Pattern

Inject the bound options into your services via IOptions<T>:

TokenService.cs
public sealed class TokenService
{
    private readonly JwtOptions _options;

    public TokenService(IOptions<JwtOptions> options)
    {
        _options = options.Value;
    }
}

Use IOptionsSnapshot<T> for per-request reloads and IOptionsMonitor<T> for change notifications. To fail fast on invalid configuration, register with AddOptions<T>().Bind(...).ValidateDataAnnotations().ValidateOnStart() — the generator can emit that form too.

appsettings.json vs Environment Variables

ASP.NET Core builds configuration from ordered providers, and later providers override earlier ones. A common order is:

  • appsettings.json
  • appsettings.{Environment}.json
  • User Secrets (Development only)
  • Environment variables
  • Command-line arguments

So a value in appsettings.jsoncan be overridden by an environment variable at deploy time — ideal for keeping secrets out of the file while sharing non-secret defaults. The exact order can change if the host is customized, so don't assume it blindly.

appsettings.json vs appsettings.Development.json

Environment-specific files layer on top of the base file for the current environment:

Files
appsettings.json               // shared defaults (committed)
appsettings.Development.json    // local overrides (committed, no secrets)
appsettings.Production.json     // production overrides (no secrets)

Keep shared settings in appsettings.json and override only what differs per environment. Do not commit production secrets to any of these files — use environment variables and secret managers instead.

Managing Secrets in ASP.NET Core

appsettings.json is not a secret store — it is plain text and usually committed. Do not put database passwords, API keys, JWT signing keys, or client secrets in it.

For local development, use User Secrets:

dotnet user-secrets
dotnet user-secrets init
dotnet user-secrets set "Jwt:Key" "your-development-secret"

For production, prefer:

  • Environment variables
  • Azure Key Vault, AWS Secrets Manager, or HashiCorp Vault
  • Managed identities (no secret in the string at all)
  • Kubernetes Secrets or CI/CD secret stores

User Secrets are a development convenience, not an enterprise production secret manager. And a Kubernetes Secret is not automatically encrypted just because of its name.

Common Configuration Mistakes

  • Invalid JSON. Trailing commas or comments — JSON supports neither.
  • Wrong environment-variable separator. Using a single _ instead of __ for nested keys.
  • Hard-coding secrets. Committing passwords and keys into appsettings.json.
  • Assuming JSON configures the framework. A Jwt, Cors, or HealthChecks section does nothing until your code reads it and calls the relevant APIs.
  • Confusing AllowedHosts with CORS. They solve different problems.
  • Wrong section names. The key in the file must exactly match the section you bind in code.

Is This Generator Private?

Yes. Every part of this tool — building, generating, parsing, validating, and converting — runs locally in your browser with JavaScript. No account or server-side processing is involved, and nothing you enter (including passwords, keys, and connection strings) is uploaded, logged, stored in localStorage, sent to analytics, or placed in the URL.

FAQ

What is appsettings.json?
appsettings.json is the default JSON configuration file for an ASP.NET Core application. At startup the host adds it as a configuration source, so any settings it contains — connection strings, logging levels, feature flags, and your own sections — become available through IConfiguration and the options pattern. It is plain JSON with a 2-space convention and no comments.
What is appsettings.Development.json?
appsettings.Development.json is an environment-specific override loaded on top of appsettings.json when ASPNETCORE_ENVIRONMENT is Development. Values in the environment file replace matching keys from the base file, so you can keep shared settings in appsettings.json and only override what differs per environment (Development, Staging, Production).
How do I create an appsettings.json file?
Add a file named appsettings.json to your project root, set it to copy to the output directory, and add JSON sections such as ConnectionStrings, Logging, and AllowedHosts. This generator builds a valid file for you: pick sections, fill in values, and copy or download the result. New ASP.NET Core project templates already include a starter appsettings.json.
How do I add a connection string to appsettings.json?
Add a "ConnectionStrings" object with a named entry, e.g. { "ConnectionStrings": { "DefaultConnection": "Server=localhost;Database=MyDb;..." } }. The name (DefaultConnection) is how you reference it in code.
How do I read a connection string in ASP.NET Core?
Use builder.Configuration.GetConnectionString("DefaultConnection"), which is shorthand for reading ConnectionStrings:DefaultConnection. Pass the result to your DbContext options (e.g. UseSqlServer(connectionString)) or client library.
How do I store JWT settings in appsettings.json?
Add a "Jwt" section with values like Issuer, Audience, and expiry, and bind it to a strongly typed options class. Keep the signing key out of the file — supply it from environment variables, User Secrets, or a key vault. Adding a Jwt section does not enable authentication by itself; you still configure AddAuthentication().AddJwtBearer(...) in code.
How do I use environment variables with appsettings.json?
ASP.NET Core adds an environment-variable configuration source that overrides appsettings.json. Nested keys use a double underscore: Jwt:Issuer becomes Jwt__Issuer, and ConnectionStrings:DefaultConnection becomes ConnectionStrings__DefaultConnection. This tool converts your configuration to environment variables in .env, Bash, PowerShell, Docker, and Kubernetes formats.
How does ASP.NET Core configuration work?
The host builds configuration from multiple providers in order: appsettings.json, appsettings.{Environment}.json, User Secrets (in Development), environment variables, and command-line arguments. Later providers override earlier ones, so the same key can be set in the file and overridden by an environment variable at deploy time. Your exact order can differ if the host is customized.
How do I convert appsettings.json to environment variables?
Flatten each nested key into a single name joined by double underscores (__) and assign the leaf value. This tool does it automatically and outputs the result for .env files, Bash/PowerShell, Docker Compose, and Kubernetes, masking sensitive values as placeholders by default.
Can I use appsettings.json with Docker?
Yes. You can bake appsettings.json into the image, but sensitive values are better injected as environment variables at runtime. In Docker Compose, set them under a service's environment block using the __ separator, and prefer ${VAR} references (from the host or an .env file) for secrets rather than hard-coding them.
Can I use appsettings.json with Kubernetes?
Yes. Non-sensitive configuration typically goes into a ConfigMap and sensitive values into a Secret, both keyed with the __ separator so they map to configuration hierarchy. Mount them as environment variables via envFrom. Kubernetes Secrets are only base64-encoded by default, so rely on your cluster's encryption-at-rest and access controls for real protection.
How do I create a C# options class from appsettings.json?
Create a class whose properties match the section's keys, then bind it with builder.Services.Configure<JwtOptions>(builder.Configuration.GetSection("Jwt")). This generator infers property types from your values and produces the class, the registration code, and an IOptions usage example.
What is the IOptions pattern?
The options pattern binds a configuration section to a strongly typed class and injects it as IOptions<T>, IOptionsSnapshot<T>, or IOptionsMonitor<T>. It gives you type safety, validation, and testability instead of reading magic strings from IConfiguration throughout your code.
Should passwords be stored in appsettings.json?
No — appsettings.json is usually committed to source control, so it is not a secret store. Keep production passwords, API keys, and signing keys in environment variables, User Secrets (for local development), or a managed secret store such as Azure Key Vault, AWS Secrets Manager, or HashiCorp Vault.
Is appsettings.json secure?
appsettings.json provides no encryption or access control on its own; it is a plain text file. Treat it as non-secret configuration and layer real secret management on top (environment variables and secret managers). A Kubernetes Secret is not automatically encrypted just because it is called a Secret.
JSON

JSON Formatter & Validator

Format, beautify, validate, and minify JSON online. Runs entirely in your browser.

Open tool
C# / .NET

JSON to C# Converter

Convert JSON into C# classes, records, and models with namespaces and serialization attributes.

Open tool
Security / API

JWT Decoder & Inspector

Decode JWT headers and payloads, inspect claims, and check expiration — entirely in your browser.

Open tool
SQL / Database

SQL Formatter & Beautifier

Format and beautify SQL queries with customizable indentation, keyword casing, and dialect support.

Open tool
Encoding

Base64 Encoder & Decoder

Encode text and files to Base64 or decode Base64 back — with UTF-8, URL-safe Base64, and Data URIs. Runs entirely in your browser.

Open tool
Identifiers

UUID Generator & Validator

Generate random UUID v4 and time-ordered v7 identifiers, generate in bulk, validate UUIDs, and inspect versions — all in your browser.

Open tool
Scheduling / DevOps

Cron Expression Generator & Helper

Build, validate, and explain Linux/Unix cron expressions visually, and preview upcoming run times — all in your browser.

Open tool
DevOps / Web Server

Nginx Config Generator

Generate Nginx configs for reverse proxies, Next.js, ASP.NET Core, Node.js, Docker, WebSockets, SSL, and static sites — all in your browser.

Open tool
Database / Connectivity

Connection String Builder

Build, validate, and explain connection strings for SQL Server, PostgreSQL, MySQL, SQLite, Oracle, MongoDB, Redis, RabbitMQ, and Azure — all in your browser.

Open tool