Microsoft.Extensions.Configuration.Json 8.0.0-preview.1.23110.8

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
EPPlus
A spreadsheet library for .NET framework and .NET core
38
EPPlus
A spreadsheet library for .NET framework and .NET core
1,620
EPPlus
Create advanced Excel spreadsheets using .NET
1,830
Microsoft.AspNetCore.App
Provides a default set of APIs for building an ASP.NET Core application. This package requires the ASP.NET Core runtime. This runtime is installed by the .NET Core SDK, or can be acquired separately using installers available at https://aka.ms/dotnet-download.
43
Microsoft.Extensions.Configuration.UserSecrets
User secrets configuration provider implementation for Microsoft.Extensions.Configuration.
38
Microsoft.Extensions.Configuration.UserSecrets
User secrets configuration provider implementation for Microsoft.Extensions.Configuration.
40
Microsoft.Extensions.Configuration.UserSecrets
User secrets configuration provider implementation for Microsoft.Extensions.Configuration.
41
Microsoft.Extensions.Configuration.UserSecrets
User secrets configuration provider implementation for Microsoft.Extensions.Configuration.
42
Microsoft.Extensions.Configuration.UserSecrets
User secrets configuration provider implementation for Microsoft.Extensions.Configuration.
43
Microsoft.Extensions.Configuration.UserSecrets
User secrets configuration provider implementation for Microsoft.Extensions.Configuration.
44
Microsoft.Extensions.Configuration.UserSecrets
User secrets configuration provider implementation for Microsoft.Extensions.Configuration.
48
TNE.Common
Package Description
9,211
Winton.Extensions.Configuration.Consul
Provides support for configuring .NET Core applications with Consul
50
Winton.Extensions.Configuration.Consul
Provides support for configuring .NET Core applications with Consul
51
Winton.Extensions.Configuration.Consul
Provides support for configuring .NET Core applications with Consul
56
Winton.Extensions.Configuration.Consul
Provides support for configuring .NET Core applications with Consul
58
Winton.Extensions.Configuration.Consul
Provides support for configuring .NET Core applications with Consul
59
Winton.Extensions.Configuration.Consul
Provides support for configuring .NET Core applications with Consul
9,198

https://go.microsoft.com/fwlink/?LinkID=799421

.NET Framework 4.6.2

.NET Standard 2.1

.NET Standard 2.0

.NET 8.0

.NET 7.0

.NET 6.0

Version Downloads Last updated
9.0.0-preview.3.24172.9 0 04/11/2024
9.0.0-preview.2.24128.5 3 03/15/2024
9.0.0-preview.1.24080.9 4 02/19/2024
8.0.0 8 11/17/2023
8.0.0-rc.2.23479.6 5 10/18/2023
8.0.0-rc.1.23419.4 8 09/30/2023
8.0.0-preview.7.23375.6 7 08/23/2023
8.0.0-preview.6.23329.7 3 08/03/2023
8.0.0-preview.5.23280.8 7 06/14/2023
8.0.0-preview.4.23259.5 8 05/17/2023
8.0.0-preview.3.23174.8 5 05/11/2023
8.0.0-preview.2.23128.3 10 03/27/2023
8.0.0-preview.1.23110.8 9 04/02/2023
7.0.0 13 12/02/2022
7.0.0-rc.2.22472.3 4 06/21/2023
7.0.0-rc.1.22426.10 8 09/21/2022
7.0.0-preview.7.22375.6 8 09/21/2022
7.0.0-preview.6.22324.4 9 09/24/2022
7.0.0-preview.5.22301.12 8 09/21/2022
7.0.0-preview.4.22229.4 9 09/22/2022
7.0.0-preview.3.22175.4 11 07/22/2022
7.0.0-preview.2.22152.2 12 09/21/2022
7.0.0-preview.1.22076.8 6 09/22/2022
6.0.2-mauipre.1.22102.15 11 09/25/2022
6.0.2-mauipre.1.22054.8 6 09/24/2022
6.0.0 7 09/21/2022
6.0.0-rc.2.21480.5 9 09/21/2022
6.0.0-rc.1.21451.13 6 09/22/2022
6.0.0-preview.7.21377.19 9 09/22/2022
6.0.0-preview.6.21352.12 4 06/21/2023
6.0.0-preview.5.21301.5 12 09/25/2022
6.0.0-preview.4.21253.7 7 09/24/2022
6.0.0-preview.3.21201.4 10 09/21/2022
6.0.0-preview.2.21154.6 9 09/25/2022
6.0.0-preview.1.21102.12 11 09/23/2022
5.0.0 1,611 09/22/2022
5.0.0-rc.2.20475.5 10 09/26/2022
5.0.0-rc.1.20451.14 16 09/21/2022
5.0.0-preview.8.20407.11 9 09/25/2022
5.0.0-preview.7.20364.11 7 09/25/2022
5.0.0-preview.6.20305.6 8 09/22/2022
5.0.0-preview.5.20278.1 10 09/23/2022
5.0.0-preview.4.20251.6 6 06/21/2023
5.0.0-preview.3.20215.2 14 09/25/2022
5.0.0-preview.2.20160.3 17 09/22/2022
5.0.0-preview.1.20120.4 9 09/22/2022
3.1.32 5 01/13/2023
3.1.31 6 01/13/2023
3.1.30 7 06/21/2023
3.1.29 6 09/22/2022
3.1.28 11 09/21/2022
3.1.27 5 09/21/2022
3.1.26 6 09/21/2022
3.1.25 9 09/23/2022
3.1.24 6 09/22/2022
3.1.23 10 09/23/2022
3.1.22 10 09/23/2022
3.1.21 4 09/23/2022
3.1.20 10 09/22/2022
3.1.19 7 09/21/2022
3.1.18 11 09/22/2022
3.1.17 8 09/22/2022
3.1.16 16 07/13/2022
3.1.15 12 09/25/2022
3.1.14 17 06/29/2022
3.1.13 5 09/22/2022
3.1.12 7 09/22/2022
3.1.11 8 09/21/2022
3.1.10 6 09/24/2022
3.1.9 5 09/21/2022
3.1.8 16 06/29/2022
3.1.7 11 09/21/2022
3.1.6 8 09/21/2022
3.1.5 9,182 06/27/2022
3.1.4 6 09/26/2022
3.1.3 6 09/25/2022
3.1.2 8 01/07/2023
3.1.1 6 06/16/2023
3.1.0 1,829 06/27/2022
3.1.0-preview3.19553.2 13 09/24/2022
3.1.0-preview2.19525.4 19 07/06/2022
3.1.0-preview1.19506.1 5 09/21/2022
3.0.3 13 09/21/2022
3.0.2 7 09/21/2022
3.0.1 5 10/15/2022
3.0.0 7 09/24/2022
3.0.0-rc1.19456.10 5 10/15/2022
3.0.0-preview9.19423.4 17 06/30/2022
3.0.0-preview8.19405.4 4 09/23/2022
3.0.0-preview7.19362.4 7 10/15/2022
3.0.0-preview6.19304.6 8 09/24/2022
3.0.0-preview5.19227.9 3 09/24/2022
3.0.0-preview4.19216.2 7 09/24/2022
3.0.0-preview3.19153.1 4 09/22/2022
3.0.0-preview.19074.2 7 09/21/2022
3.0.0-preview.18572.1 10 09/23/2022
2.2.0 5 09/21/2022
2.2.0-preview3-35497 3 09/22/2022
2.2.0-preview2-35157 9 09/21/2022
2.2.0-preview1-35029 9 09/26/2022
2.1.1 6 09/21/2022
2.1.0 7 06/27/2022
2.1.0-rc1-final 8 10/15/2022
2.1.0-preview2-final 9 09/22/2022
2.1.0-preview1-final 6 09/24/2022
2.0.2 3 09/22/2022
2.0.1 26 07/13/2022
2.0.0 25 07/02/2022
2.0.0-preview2-final 6 09/26/2022
2.0.0-preview1-final 8 10/15/2022
1.1.2 8 09/21/2022
1.1.1 5 09/21/2022
1.1.0 6 09/26/2022
1.1.0-preview1-final 21 06/28/2022
1.0.2 5 09/21/2022
1.0.1 6 09/21/2022
1.0.0 4 10/01/2023
1.0.0-rc2-final 11 09/11/2022
1.0.0-rc1-final 12 07/28/2022