Microsoft.Extensions.Configuration.Json 10.0.0-preview.2.25163.2
About
JSON configuration provider implementation for Microsoft.Extensions.Configuration. This package enables you to read your application's settings from a JSON file. You can use JsonConfigurationExtensions.AddJsonFile extension method on IConfigurationBuilder
to add the JSON configuration provider to the configuration builder.
How to Use
The following example shows how to read application settings from the JSON configuration file.
using System;
using Microsoft.Extensions.Configuration;
class Program
{
static void Main()
{
// Build a configuration object from JSON file
IConfiguration config = new ConfigurationBuilder()
.AddJsonFile("appsettings.json")
.Build();
// Get a configuration section
IConfigurationSection section = config.GetSection("Settings");
// Read simple values
Console.WriteLine($"Server: {section["Server"]}");
Console.WriteLine($"Database: {section["Database"]}");
// Read a collection
Console.WriteLine("Ports: ");
IConfigurationSection ports = section.GetSection("Ports");
foreach (IConfigurationSection child in ports.GetChildren())
{
Console.WriteLine(child.Value);
}
}
}
To run this example, include an appsettings.json
file with the following content in your project:
{
"Settings": {
"Server": "example.com",
"Database": "Northwind",
"Ports": [ 80, 81 ]
}
}
You can include a configuration file using a code like this in your .csproj
file:
<ItemGroup>
<Content Include="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
Additional Documentation
Feedback & Contributing
Microsoft.Extensions.Configuration.Json is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.
Showing the top 20 packages that depend on Microsoft.Extensions.Configuration.Json.
Packages | Downloads |
---|---|
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
|
1,449 |
Microsoft.Extensions.Configuration.UserSecrets
User secrets configuration provider implementation for Microsoft.Extensions.Configuration.
|
1,439 |
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
|
1,419 |
Microsoft.Extensions.Configuration.UserSecrets
User secrets configuration provider implementation for Microsoft.Extensions.Configuration. User secrets mechanism enables you to override application configuration settings with values stored in the local secrets file. You can use UserSecretsConfigurationExtensions.AddUserSecrets extension method on IConfigurationBuilder to add user secrets provider to the configuration builder.
|
1,409 |
Microsoft.ApplicationInsights.AspNetCore
Application Insights for ASP.NET Core web applications. See https://azure.microsoft.com/documentation/articles/app-insights-asp-net-five/ for more information. Privacy statement: https://go.microsoft.com/fwlink/?LinkId=512156
|
69 |
Microsoft.ApplicationInsights.AspNetCore
Application Insights for ASP.NET Core web applications. See https://azure.microsoft.com/documentation/articles/app-insights-asp-net-five/ for more information. Privacy statement: https://go.microsoft.com/fwlink/?LinkId=512156
|
65 |
Microsoft.AspNetCore
Microsoft.AspNetCore
|
55 |
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
When using NuGet 3.x this package requires at least version 3.4.
|
55 |
Microsoft.AspNetCore.Components.WebAssembly
Build client-side single-page applications (SPAs) with Blazor running under WebAssembly.
This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/36f34b3a19eb7219142ab2035921d08e84c572c3
|
55 |
Microsoft.ApplicationInsights.AspNetCore
Application Insights for ASP.NET Core web applications. See https://azure.microsoft.com/documentation/articles/app-insights-asp-net-five/ for more information. Privacy statement: https://go.microsoft.com/fwlink/?LinkId=512156
|
54 |
Microsoft.AspNetCore
Microsoft.AspNetCore
|
53 |
Microsoft.ApplicationInsights.AspNetCore
Application Insights for ASP.NET Core web applications. See https://azure.microsoft.com/documentation/articles/app-insights-asp-net-five/ for more information. Privacy statement: https://go.microsoft.com/fwlink/?LinkId=512156
|
52 |
Microsoft.AspNetCore.Components.WebAssembly
Build client-side single-page applications (SPAs) with Blazor running under WebAssembly.
This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/d47e49e9c1e173ac90821f7e89cc38e710274241
|
52 |
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
|
52 |
Microsoft.ApplicationInsights.AspNetCore
Application Insights for ASP.NET Core web applications. See https://azure.microsoft.com/documentation/articles/app-insights-asp-net-five/ for more information. Privacy statement: https://go.microsoft.com/fwlink/?LinkId=512156
|
50 |
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
|
50 |
Microsoft.AspNetCore.Components.WebAssembly
Build client-side single-page applications (SPAs) with Blazor running under WebAssembly.
This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/f0cc6b11bd8f0826c63d75483578e868c8abe75e
|
50 |
Microsoft.AspNetCore.Components.WebAssembly
Build client-side single-page applications (SPAs) with Blazor running under WebAssembly.
This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/ecdcc752d4639061c2c49727ee77a1039bbbca22
|
49 |
.NET Framework 4.6.2
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.0-preview.2.25163.2)
- Microsoft.Extensions.Configuration.FileExtensions (>= 10.0.0-preview.2.25163.2)
- Microsoft.Extensions.Configuration (>= 10.0.0-preview.2.25163.2)
- Microsoft.Extensions.FileProviders.Abstractions (>= 10.0.0-preview.2.25163.2)
- System.Text.Json (>= 10.0.0-preview.2.25163.2)
.NET Standard 2.1
- System.Text.Json (>= 10.0.0-preview.2.25163.2)
- Microsoft.Extensions.FileProviders.Abstractions (>= 10.0.0-preview.2.25163.2)
- Microsoft.Extensions.Configuration (>= 10.0.0-preview.2.25163.2)
- Microsoft.Extensions.Configuration.FileExtensions (>= 10.0.0-preview.2.25163.2)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.0-preview.2.25163.2)
.NET Standard 2.0
- System.Text.Json (>= 10.0.0-preview.2.25163.2)
- Microsoft.Extensions.FileProviders.Abstractions (>= 10.0.0-preview.2.25163.2)
- Microsoft.Extensions.Configuration (>= 10.0.0-preview.2.25163.2)
- Microsoft.Extensions.Configuration.FileExtensions (>= 10.0.0-preview.2.25163.2)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.0-preview.2.25163.2)
.NET 10.0
- Microsoft.Extensions.FileProviders.Abstractions (>= 10.0.0-preview.2.25163.2)
- Microsoft.Extensions.Configuration.FileExtensions (>= 10.0.0-preview.2.25163.2)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.0-preview.2.25163.2)
- Microsoft.Extensions.Configuration (>= 10.0.0-preview.2.25163.2)
.NET 9.0
- Microsoft.Extensions.FileProviders.Abstractions (>= 10.0.0-preview.2.25163.2)
- System.Text.Json (>= 10.0.0-preview.2.25163.2)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.0-preview.2.25163.2)
- Microsoft.Extensions.Configuration.FileExtensions (>= 10.0.0-preview.2.25163.2)
- Microsoft.Extensions.Configuration (>= 10.0.0-preview.2.25163.2)
.NET 8.0
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.0-preview.2.25163.2)
- Microsoft.Extensions.Configuration.FileExtensions (>= 10.0.0-preview.2.25163.2)
- Microsoft.Extensions.FileProviders.Abstractions (>= 10.0.0-preview.2.25163.2)
- System.Text.Json (>= 10.0.0-preview.2.25163.2)
- Microsoft.Extensions.Configuration (>= 10.0.0-preview.2.25163.2)
Version | Downloads | Last updated |
---|---|---|
10.0.0-preview.3.25171.5 | 5 | 04/11/2025 |
10.0.0-preview.2.25163.2 | 5 | 03/21/2025 |
10.0.0-preview.1.25080.5 | 5 | 03/01/2025 |
9.0.4 | 5 | 04/10/2025 |
9.0.3 | 5 | 03/15/2025 |
9.0.2 | 8 | 02/13/2025 |
9.0.1 | 10 | 01/17/2025 |
9.0.0 | 17 | 11/13/2024 |
9.0.0-rc.2.24473.5 | 12 | 10/08/2024 |
9.0.0-rc.1.24431.7 | 13 | 09/17/2024 |
9.0.0-preview.7.24405.7 | 19 | 08/14/2024 |
9.0.0-preview.6.24327.7 | 22 | 07/10/2024 |
9.0.0-preview.5.24306.7 | 23 | 06/12/2024 |
9.0.0-preview.4.24266.19 | 21 | 06/06/2024 |
9.0.0-preview.3.24172.9 | 21 | 04/11/2024 |
9.0.0-preview.2.24128.5 | 20 | 04/07/2024 |
9.0.0-preview.1.24080.9 | 22 | 03/09/2024 |
8.0.1 | 15 | 10/08/2024 |
8.0.0 | 1,412 | 11/29/2023 |
8.0.0-rc.2.23479.6 | 25 | 10/17/2023 |
8.0.0-rc.1.23419.4 | 25 | 09/20/2023 |
8.0.0-preview.7.23375.6 | 24 | 08/29/2023 |
8.0.0-preview.6.23329.7 | 23 | 09/01/2023 |
8.0.0-preview.5.23280.8 | 26 | 09/01/2023 |
8.0.0-preview.4.23259.5 | 27 | 06/03/2023 |
8.0.0-preview.3.23174.8 | 27 | 04/23/2023 |
8.0.0-preview.2.23128.3 | 28 | 07/09/2023 |
8.0.0-preview.1.23110.8 | 29 | 07/17/2023 |
7.0.0 | 34 | 04/13/2023 |
7.0.0-rc.2.22472.3 | 26 | 07/12/2023 |
7.0.0-rc.1.22426.10 | 24 | 03/05/2023 |
7.0.0-preview.7.22375.6 | 29 | 10/20/2022 |
7.0.0-preview.6.22324.4 | 26 | 07/14/2023 |
7.0.0-preview.5.22301.12 | 26 | 07/03/2023 |
7.0.0-preview.4.22229.4 | 26 | 12/04/2022 |
7.0.0-preview.3.22175.4 | 27 | 07/08/2023 |
7.0.0-preview.2.22152.2 | 31 | 06/22/2022 |
7.0.0-preview.1.22076.8 | 28 | 03/18/2023 |
6.0.2-mauipre.1.22102.15 | 21 | 10/14/2022 |
6.0.2-mauipre.1.22054.8 | 30 | 07/15/2022 |
6.0.1 | 15 | 11/13/2024 |
6.0.0 | 1,433 | 12/15/2021 |
6.0.0-rc.2.21480.5 | 26 | 07/14/2023 |
6.0.0-rc.1.21451.13 | 24 | 07/10/2023 |
6.0.0-preview.7.21377.19 | 23 | 07/02/2023 |
6.0.0-preview.6.21352.12 | 26 | 12/26/2021 |
6.0.0-preview.5.21301.5 | 26 | 06/10/2023 |
6.0.0-preview.4.21253.7 | 28 | 07/08/2023 |
6.0.0-preview.3.21201.4 | 28 | 10/06/2022 |
6.0.0-preview.2.21154.6 | 28 | 09/10/2022 |
6.0.0-preview.1.21102.12 | 28 | 08/03/2022 |
5.0.0 | 28 | 06/19/2023 |
5.0.0-rc.2.20475.5 | 29 | 07/22/2022 |
5.0.0-rc.1.20451.14 | 24 | 07/05/2023 |
5.0.0-preview.8.20407.11 | 22 | 07/09/2023 |
5.0.0-preview.7.20364.11 | 26 | 07/21/2023 |
5.0.0-preview.6.20305.6 | 24 | 07/09/2023 |
5.0.0-preview.5.20278.1 | 24 | 07/08/2023 |
5.0.0-preview.4.20251.6 | 28 | 12/02/2022 |
5.0.0-preview.3.20215.2 | 24 | 06/06/2023 |
5.0.0-preview.2.20160.3 | 26 | 09/03/2022 |
5.0.0-preview.1.20120.4 | 24 | 05/28/2023 |
3.1.32 | 28 | 02/28/2023 |
3.1.31 | 25 | 05/05/2023 |
3.1.30 | 30 | 01/18/2023 |
3.1.29 | 31 | 05/10/2023 |
3.1.28 | 30 | 05/16/2023 |
3.1.27 | 28 | 10/06/2022 |
3.1.26 | 27 | 07/05/2023 |
3.1.25 | 33 | 09/01/2022 |
3.1.24 | 26 | 05/25/2023 |
3.1.23 | 29 | 03/06/2023 |
3.1.22 | 34 | 01/18/2023 |
3.1.21 | 28 | 05/20/2023 |
3.1.20 | 33 | 04/16/2023 |
3.1.19 | 36 | 12/20/2021 |
3.1.18 | 26 | 07/13/2023 |
3.1.17 | 37 | 12/15/2021 |
3.1.16 | 39 | 04/16/2023 |
3.1.15 | 32 | 07/08/2022 |
3.1.14 | 31 | 12/15/2021 |
3.1.13 | 39 | 12/15/2021 |
3.1.12 | 25 | 06/11/2023 |
3.1.11 | 36 | 12/15/2021 |
3.1.10 | 32 | 12/26/2021 |
3.1.9 | 27 | 10/04/2022 |
3.1.8 | 28 | 05/18/2023 |
3.1.7 | 25 | 05/13/2023 |
3.1.6 | 31 | 12/26/2021 |
3.1.5 | 32 | 05/05/2023 |
3.1.4 | 31 | 05/18/2023 |
3.1.3 | 39 | 11/22/2022 |
3.1.2 | 28 | 07/05/2023 |
3.1.1 | 29 | 05/04/2023 |
3.1.0 | 31 | 05/13/2023 |
3.1.0-preview3.19553.2 | 28 | 12/20/2022 |
3.1.0-preview2.19525.4 | 25 | 12/25/2021 |
3.1.0-preview1.19506.1 | 27 | 07/12/2023 |
3.0.3 | 37 | 02/17/2023 |
3.0.2 | 40 | 08/07/2022 |
3.0.1 | 31 | 12/20/2021 |
3.0.0 | 28 | 05/22/2023 |
3.0.0-rc1.19456.10 | 35 | 02/24/2023 |
3.0.0-preview9.19423.4 | 25 | 07/09/2023 |
3.0.0-preview8.19405.4 | 25 | 07/10/2023 |
3.0.0-preview7.19362.4 | 23 | 07/07/2023 |
3.0.0-preview6.19304.6 | 28 | 07/02/2023 |
3.0.0-preview5.19227.9 | 25 | 06/23/2022 |
3.0.0-preview4.19216.2 | 25 | 07/11/2023 |
3.0.0-preview3.19153.1 | 26 | 07/09/2023 |
3.0.0-preview.19074.2 | 29 | 10/20/2022 |
3.0.0-preview.18572.1 | 27 | 12/19/2022 |
2.2.0 | 29 | 12/15/2021 |
2.2.0-preview3-35497 | 24 | 07/11/2023 |
2.2.0-preview2-35157 | 26 | 05/17/2023 |
2.2.0-preview1-35029 | 25 | 07/03/2023 |
2.1.1 | 26 | 04/19/2023 |
2.1.0 | 30 | 12/15/2021 |
2.1.0-rc1-final | 28 | 05/30/2023 |
2.1.0-preview2-final | 31 | 11/06/2022 |
2.1.0-preview1-final | 29 | 07/10/2023 |
2.0.2 | 37 | 12/15/2021 |
2.0.1 | 41 | 12/15/2021 |
2.0.0 | 35 | 12/21/2021 |
2.0.0-preview2-final | 30 | 04/28/2023 |
2.0.0-preview1-final | 36 | 10/03/2022 |
1.1.2 | 28 | 01/18/2023 |
1.1.1 | 32 | 12/15/2021 |
1.1.0 | 32 | 02/24/2023 |
1.1.0-preview1-final | 31 | 07/07/2023 |
1.0.2 | 46 | 12/21/2021 |
1.0.1 | 32 | 12/21/2021 |
1.0.0 | 33 | 07/01/2023 |
1.0.0-rc2-final | 27 | 04/21/2023 |
1.0.0-rc1-final | 29 | 12/20/2021 |