AppSettings.json
ASP.NET stores application configuration settings in Web.config. For example, developers use the <appSettings> section to store custom application settings, the <connectionStrings> section to store database connection strings, and so on. ASP.NET Core uses AppSettings.json to store such pieces of information. Consider the following configuration:
{
"AppSettings": {
"Title": "My ASP.NET Core Application"
},
"Data": {
"DefaultConnection": {
"ConnectionString": "data source=.;
initial catalog=Northwind;integrated security=true"
}
}
}
The preceding JSON markup consists of two properties or keys, namely AppSettings and Data. The AppSettings property holds a sub-key named Title. The Title sub-key has a string value of “My ASP.NET Core Application”. Similarly, the Data key has a DefaultConnection sub-key. The DefaultConnection in turn has a ConnectionString sub-key.
You can read the values stored in AppSettings.json using ConfigurationBuilder and IConfiguration.