Microsoft.Extensions.Configuration.Json 9.0.0-preview.2.24128.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.
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 |
---|---|
Magicodes.Next.EPPlus
The next version of [Magicodes.IE]( https://github.com/dotnetcore/Magicodes.IE ), a more friendly library to use in ABP framework.
|
177 |
Magicodes.Next.EPPlus
The next version of [Magicodes.IE]( https://github.com/dotnetcore/Magicodes.IE ), a more friendly library to use in ABP framework.
|
155 |
Magicodes.Next.EPPlus
The next version of [Magicodes.IE]( https://github.com/dotnetcore/Magicodes.IE ), a more friendly library to use in ABP framework.
|
149 |
Magicodes.Next.EPPlus
The next version of [Magicodes.IE]( https://github.com/dotnetcore/Magicodes.IE ), a more friendly library to use in ABP framework.
|
62 |
Magicodes.Next.EPPlus
The next version of [Magicodes.IE]( https://github.com/dotnetcore/Magicodes.IE ), a more friendly library to use in ABP framework.
|
61 |
Magicodes.Next.EPPlus
The next version of [Magicodes.IE]( https://github.com/dotnetcore/Magicodes.IE ), a more friendly library to use in ABP framework.
|
23 |
Magicodes.Next.EPPlus
The next version of [Magicodes.IE]( https://github.com/dotnetcore/Magicodes.IE ), a more friendly library to use in ABP framework.
|
22 |
Magicodes.Next.EPPlus
The next version of [Magicodes.IE]( https://github.com/dotnetcore/Magicodes.IE ), a more friendly library to use in ABP framework.
|
21 |
Magicodes.Next.EPPlus
The next version of [Magicodes.IE]( https://github.com/dotnetcore/Magicodes.IE ), a more friendly library to use in ABP framework.
|
14 |
Magicodes.Next.EPPlus
The next version of [Magicodes.IE]( https://github.com/dotnetcore/Magicodes.IE ), a more friendly library to use in ABP framework.
|
12 |
Magicodes.Next.EPPlus
The next version of [Magicodes.IE]( https://github.com/dotnetcore/Magicodes.IE ), a more friendly library to use in ABP framework.
|
11 |
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
|
9 |
Magicodes.Next.EPPlus
The next version of [Magicodes.IE]( https://github.com/dotnetcore/Magicodes.IE ), a more friendly library to use in ABP framework.
|
9 |
Magicodes.Next.EPPlus
The next version of [Magicodes.IE]( https://github.com/dotnetcore/Magicodes.IE ), a more friendly library to use in ABP framework.
|
7 |
Microsoft.Extensions.Configuration.UserSecrets
User secrets configuration provider implementation for Microsoft.Extensions.Configuration.
|
6 |
Magicodes.Next.EPPlus
The next version of [Magicodes.IE]( https://github.com/dotnetcore/Magicodes.IE ), a more friendly library to use in ABP framework.
|
6 |
Magicodes.Next.EPPlus
The next version of [Magicodes.IE]( https://github.com/dotnetcore/Magicodes.IE ), a more friendly library to use in ABP framework.
|
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/54142bcb25544b72fac28b1b061e7788c91c4f49
|
3 |
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
|
3 |
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
|
2 |
.NET Framework 4.6.2
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.0-preview.2.24128.5)
- Microsoft.Extensions.Configuration.FileExtensions (>= 9.0.0-preview.2.24128.5)
- Microsoft.Extensions.Configuration (>= 9.0.0-preview.2.24128.5)
- Microsoft.Extensions.FileProviders.Abstractions (>= 9.0.0-preview.2.24128.5)
- System.Text.Json (>= 9.0.0-preview.2.24128.5)
.NET Standard 2.1
- System.Text.Json (>= 9.0.0-preview.2.24128.5)
- Microsoft.Extensions.FileProviders.Abstractions (>= 9.0.0-preview.2.24128.5)
- Microsoft.Extensions.Configuration (>= 9.0.0-preview.2.24128.5)
- Microsoft.Extensions.Configuration.FileExtensions (>= 9.0.0-preview.2.24128.5)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.0-preview.2.24128.5)
.NET Standard 2.0
- System.Text.Json (>= 9.0.0-preview.2.24128.5)
- Microsoft.Extensions.FileProviders.Abstractions (>= 9.0.0-preview.2.24128.5)
- Microsoft.Extensions.Configuration (>= 9.0.0-preview.2.24128.5)
- Microsoft.Extensions.Configuration.FileExtensions (>= 9.0.0-preview.2.24128.5)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.0-preview.2.24128.5)
.NET 9.0
- System.Text.Json (>= 9.0.0-preview.2.24128.5)
- Microsoft.Extensions.FileProviders.Abstractions (>= 9.0.0-preview.2.24128.5)
- Microsoft.Extensions.Configuration.FileExtensions (>= 9.0.0-preview.2.24128.5)
- Microsoft.Extensions.Configuration (>= 9.0.0-preview.2.24128.5)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.0-preview.2.24128.5)
.NET 8.0
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.0-preview.2.24128.5)
- Microsoft.Extensions.Configuration (>= 9.0.0-preview.2.24128.5)
- Microsoft.Extensions.FileProviders.Abstractions (>= 9.0.0-preview.2.24128.5)
- System.Text.Json (>= 9.0.0-preview.2.24128.5)
- Microsoft.Extensions.Configuration.FileExtensions (>= 9.0.0-preview.2.24128.5)