Microsoft.Extensions.Configuration.Json 9.0.1
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 |
---|---|
DevExpress.AspNetCore.Reporting
This package implements the functionality related to the DevExpress Report Designer and Report Viewer ASP.NET Core controls.
|
16 |
EPPlus
A spreadsheet library for .NET framework and .NET core
|
7 |
EPPlus
A spreadsheet library for .NET framework and .NET core
|
4 |
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/50b7e9c661453874aa7a54a3985d5120564bb2e5
|
4 |
Microsoft.Identity.Web.TokenAcquisition
Implementation for higher level API for confidential client applications (ASP.NET Core and SDK/.NET).
|
4 |
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/f0f9de5692adf1c0576de062f93c6ab7b176433f
|
4 |
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/68bb6fb08f8f85bb3cf08953a0d2f4a254eaccff
|
3 |
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/bb01bbf4433e27289b99001b7de6a582879d1835
|
3 |
Microsoft.ApplicationInsights.AspNetCore
Application Insights for ASP.NET Core web applications. See https://azure.microsoft.com/en-us/documentation/articles/app-insights-asp-net-five/ for more information. Privacy statement: https://go.microsoft.com/fwlink/?LinkId=512156
|
3 |
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
When using NuGet 3.x this package requires at least version 3.4.
|
3 |
EPPlus
A spreadsheet library for .NET framework and .NET core
|
3 |
.NET Framework 4.6.2
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.1)
- Microsoft.Extensions.Configuration.FileExtensions (>= 9.0.1)
- Microsoft.Extensions.Configuration (>= 9.0.1)
- System.Text.Json (>= 9.0.1)
- Microsoft.Extensions.FileProviders.Abstractions (>= 9.0.1)
.NET Standard 2.1
- System.Text.Json (>= 9.0.1)
- Microsoft.Extensions.FileProviders.Abstractions (>= 9.0.1)
- Microsoft.Extensions.Configuration (>= 9.0.1)
- Microsoft.Extensions.Configuration.FileExtensions (>= 9.0.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.1)
.NET Standard 2.0
- System.Text.Json (>= 9.0.1)
- Microsoft.Extensions.FileProviders.Abstractions (>= 9.0.1)
- Microsoft.Extensions.Configuration (>= 9.0.1)
- Microsoft.Extensions.Configuration.FileExtensions (>= 9.0.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.1)
.NET 9.0
- Microsoft.Extensions.FileProviders.Abstractions (>= 9.0.1)
- Microsoft.Extensions.Configuration (>= 9.0.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.1)
- Microsoft.Extensions.Configuration.FileExtensions (>= 9.0.1)
.NET 8.0
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.1)
- Microsoft.Extensions.Configuration (>= 9.0.1)
- Microsoft.Extensions.FileProviders.Abstractions (>= 9.0.1)
- System.Text.Json (>= 9.0.1)
- Microsoft.Extensions.Configuration.FileExtensions (>= 9.0.1)