Microsoft.Extensions.Configuration.Json 9.0.10
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.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/379bfc7b2559e7cc9f42f997a497b2f2dd8e12d2
|
8 |
|
EPPlus
A spreadsheet library for .NET framework and .NET core
|
6 |
|
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/f6b3a5da75eb405046889a5447ec9b14cc29d285
|
6 |
|
Microsoft.Orleans.Core
Core library of Microsoft Orleans used both on the client and server.
|
6 |
|
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
|
5 |
|
EPPlus
Create advanced Excel spreadsheets using .NET
|
5 |
|
EPPlus
A spreadsheet library for .NET framework and .NET core
|
4 |
|
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.
|
4 |
|
Microsoft.Orleans.Core
Core library of Microsoft Orleans used both on the client and server.
|
4 |
|
Meadow
Core .NET libraries for Wilderness Labs Meadow
|
4 |
|
Microsoft.AspNetCore.Components.WebView
Build desktop applications with Blazor and a webview.
This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/ed74665e773dd1ebea3289c5662d71c590305932
|
4 |
|
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
|
4 |
|
Microsoft.AspNetCore.Components.WebView
Build desktop applications with Blazor and a webview.
This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/954f61dd38b33caa2b736c73530bd5a294174437
|
4 |
|
Microsoft.Extensions.Configuration.UserSecrets
User secrets configuration provider implementation for Microsoft.Extensions.Configuration.
|
4 |
|
BootstrapBlazor
Bootstrap UI components for Blazor and Razor Components
|
4 |
.NET Framework 4.6.2
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Configuration.FileExtensions (>= 9.0.10)
- Microsoft.Extensions.Configuration (>= 9.0.10)
- Microsoft.Extensions.FileProviders.Abstractions (>= 9.0.10)
- System.Text.Json (>= 9.0.10)
.NET 8.0
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Configuration.FileExtensions (>= 9.0.10)
- Microsoft.Extensions.Configuration (>= 9.0.10)
- Microsoft.Extensions.FileProviders.Abstractions (>= 9.0.10)
- System.Text.Json (>= 9.0.10)
.NET 9.0
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Configuration.FileExtensions (>= 9.0.10)
- Microsoft.Extensions.Configuration (>= 9.0.10)
- Microsoft.Extensions.FileProviders.Abstractions (>= 9.0.10)
.NET Standard 2.0
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Configuration.FileExtensions (>= 9.0.10)
- Microsoft.Extensions.Configuration (>= 9.0.10)
- Microsoft.Extensions.FileProviders.Abstractions (>= 9.0.10)
- System.Text.Json (>= 9.0.10)
.NET Standard 2.1
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Configuration.FileExtensions (>= 9.0.10)
- Microsoft.Extensions.Configuration (>= 9.0.10)
- Microsoft.Extensions.FileProviders.Abstractions (>= 9.0.10)
- System.Text.Json (>= 9.0.10)