Microsoft.Extensions.Configuration.Json 8.0.0-preview.6.23329.7
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.
For more information, see the documentation: JSON configuration provider.
Example
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>
Showing the top 20 packages that depend on Microsoft.Extensions.Configuration.Json.
Packages | Downloads |
---|---|
Microsoft.Extensions.Configuration.UserSecrets
User secrets configuration provider implementation for Microsoft.Extensions.Configuration.
|
14 |
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
|
10 |
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
|
9 |
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
|
8 |
Microsoft.Extensions.Configuration.UserSecrets
User secrets configuration provider implementation for Microsoft.Extensions.Configuration.
|
8 |
IppDotNetSdkForQuickBooksApiV3
The IPP .NET SDK for QuickBooks V3 is a set of .NET classes that make it easier to call QuickBooks APIs. This is the .Net Standard 2.0 version of the .Net SDK
|
8 |
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.
|
7 |
IppDotNetSdkForQuickBooksApiV3
The IPP .NET SDK for QuickBooks V3 is a set of .NET classes that make it easier to call QuickBooks APIs. This is the .Net Standard 2.0 version of the .Net SDK
|
7 |
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
|
6 |
Microsoft.Extensions.Configuration.UserSecrets
User secrets configuration provider implementation for Microsoft.Extensions.Configuration.
|
6 |
IppDotNetSdkForQuickBooksApiV3
The IPP .NET SDK for QuickBooks V3 is a set of .NET classes that make it easier to call QuickBooks APIs. This is the .Net Standard 2.0 version of the .Net SDK
|
6 |
Microsoft.Extensions.Configuration.UserSecrets
User secrets configuration provider implementation for Microsoft.Extensions.Configuration.
|
5 |
.NET Framework 4.6.2
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0-preview.6.23329.7)
- Microsoft.Extensions.Configuration.FileExtensions (>= 8.0.0-preview.6.23329.7)
- Microsoft.Extensions.Configuration (>= 8.0.0-preview.6.23329.7)
- Microsoft.Extensions.FileProviders.Abstractions (>= 8.0.0-preview.6.23329.7)
- System.Text.Json (>= 8.0.0-preview.6.23329.7)
.NET Standard 2.1
- System.Text.Json (>= 8.0.0-preview.6.23329.7)
- Microsoft.Extensions.FileProviders.Abstractions (>= 8.0.0-preview.6.23329.7)
- Microsoft.Extensions.Configuration (>= 8.0.0-preview.6.23329.7)
- Microsoft.Extensions.Configuration.FileExtensions (>= 8.0.0-preview.6.23329.7)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0-preview.6.23329.7)
.NET Standard 2.0
- System.Text.Json (>= 8.0.0-preview.6.23329.7)
- Microsoft.Extensions.FileProviders.Abstractions (>= 8.0.0-preview.6.23329.7)
- Microsoft.Extensions.Configuration (>= 8.0.0-preview.6.23329.7)
- Microsoft.Extensions.Configuration.FileExtensions (>= 8.0.0-preview.6.23329.7)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0-preview.6.23329.7)
.NET 8.0
- System.Text.Json (>= 8.0.0-preview.6.23329.7)
- Microsoft.Extensions.Configuration (>= 8.0.0-preview.6.23329.7)
- Microsoft.Extensions.Configuration.FileExtensions (>= 8.0.0-preview.6.23329.7)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0-preview.6.23329.7)
- Microsoft.Extensions.FileProviders.Abstractions (>= 8.0.0-preview.6.23329.7)
.NET 7.0
- Microsoft.Extensions.FileProviders.Abstractions (>= 8.0.0-preview.6.23329.7)
- System.Text.Json (>= 8.0.0-preview.6.23329.7)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0-preview.6.23329.7)
- Microsoft.Extensions.Configuration.FileExtensions (>= 8.0.0-preview.6.23329.7)
- Microsoft.Extensions.Configuration (>= 8.0.0-preview.6.23329.7)
.NET 6.0
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0-preview.6.23329.7)
- Microsoft.Extensions.Configuration.FileExtensions (>= 8.0.0-preview.6.23329.7)
- Microsoft.Extensions.FileProviders.Abstractions (>= 8.0.0-preview.6.23329.7)
- System.Text.Json (>= 8.0.0-preview.6.23329.7)
- Microsoft.Extensions.Configuration (>= 8.0.0-preview.6.23329.7)