Microsoft.Extensions.Configuration.Json 8.0.0-preview.4.23259.5
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.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications.
|
54 |
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications.
|
50 |
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications.
|
49 |
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications.
|
48 |
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications.
|
47 |
R4Mvc.Tools
R4Mvc is a tool that generates strongly typed helpers for ASP.NET Core MVC.
|
46 |
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications.
|
46 |
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications.
|
45 |
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications.
|
43 |
R4Mvc.Tools
R4Mvc is a tool that generates strongly typed helpers for ASP.NET Core MVC.
|
42 |
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications.
|
42 |
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications.
|
41 |
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications.
|
40 |
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications.
|
39 |
R4Mvc.Tools
R4Mvc is a tool that generates strongly typed helpers for ASP.NET Core MVC.
|
39 |
.NET Framework 4.6.2
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0-preview.4.23259.5)
- Microsoft.Extensions.Configuration.FileExtensions (>= 8.0.0-preview.4.23259.5)
- Microsoft.Extensions.Configuration (>= 8.0.0-preview.4.23259.5)
- Microsoft.Extensions.FileProviders.Abstractions (>= 8.0.0-preview.4.23259.5)
- System.Text.Json (>= 8.0.0-preview.4.23259.5)
.NET Standard 2.1
- System.Text.Json (>= 8.0.0-preview.4.23259.5)
- Microsoft.Extensions.FileProviders.Abstractions (>= 8.0.0-preview.4.23259.5)
- Microsoft.Extensions.Configuration (>= 8.0.0-preview.4.23259.5)
- Microsoft.Extensions.Configuration.FileExtensions (>= 8.0.0-preview.4.23259.5)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0-preview.4.23259.5)
.NET Standard 2.0
- System.Text.Json (>= 8.0.0-preview.4.23259.5)
- Microsoft.Extensions.FileProviders.Abstractions (>= 8.0.0-preview.4.23259.5)
- Microsoft.Extensions.Configuration (>= 8.0.0-preview.4.23259.5)
- Microsoft.Extensions.Configuration.FileExtensions (>= 8.0.0-preview.4.23259.5)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0-preview.4.23259.5)
.NET 8.0
- System.Text.Json (>= 8.0.0-preview.4.23259.5)
- Microsoft.Extensions.Configuration (>= 8.0.0-preview.4.23259.5)
- Microsoft.Extensions.Configuration.FileExtensions (>= 8.0.0-preview.4.23259.5)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0-preview.4.23259.5)
- Microsoft.Extensions.FileProviders.Abstractions (>= 8.0.0-preview.4.23259.5)
.NET 7.0
- Microsoft.Extensions.FileProviders.Abstractions (>= 8.0.0-preview.4.23259.5)
- System.Text.Json (>= 8.0.0-preview.4.23259.5)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0-preview.4.23259.5)
- Microsoft.Extensions.Configuration.FileExtensions (>= 8.0.0-preview.4.23259.5)
- Microsoft.Extensions.Configuration (>= 8.0.0-preview.4.23259.5)
.NET 6.0
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0-preview.4.23259.5)
- Microsoft.Extensions.Configuration.FileExtensions (>= 8.0.0-preview.4.23259.5)
- Microsoft.Extensions.FileProviders.Abstractions (>= 8.0.0-preview.4.23259.5)
- System.Text.Json (>= 8.0.0-preview.4.23259.5)
- Microsoft.Extensions.Configuration (>= 8.0.0-preview.4.23259.5)