Microsoft.Extensions.Configuration.Json 9.0.0-rc.2.24473.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
EPPlus
A spreadsheet library for .NET framework and .NET core
63
EPPlus
A spreadsheet library for .NET framework and .NET core
1,808
EPPlus
Create advanced Excel spreadsheets using .NET
2,005
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.
61
Microsoft.Extensions.Configuration.UserSecrets
User secrets configuration provider implementation for Microsoft.Extensions.Configuration.
58
Microsoft.Extensions.Configuration.UserSecrets
User secrets configuration provider implementation for Microsoft.Extensions.Configuration.
59
Microsoft.Extensions.Configuration.UserSecrets
User secrets configuration provider implementation for Microsoft.Extensions.Configuration.
61
Microsoft.Extensions.Configuration.UserSecrets
User secrets configuration provider implementation for Microsoft.Extensions.Configuration.
62
Microsoft.Extensions.Configuration.UserSecrets
User secrets configuration provider implementation for Microsoft.Extensions.Configuration.
64
Microsoft.Extensions.Configuration.UserSecrets
User secrets configuration provider implementation for Microsoft.Extensions.Configuration.
72
Microsoft.Extensions.Configuration.UserSecrets
User secrets configuration provider implementation for Microsoft.Extensions.Configuration. When using NuGet 3.x this package requires at least version 3.4.
60
TNE.Common
Package Description
10,063
Winton.Extensions.Configuration.Consul
Provides support for configuring .NET Core applications with Consul
61
Winton.Extensions.Configuration.Consul
Provides support for configuring .NET Core applications with Consul
63
Winton.Extensions.Configuration.Consul
Provides support for configuring .NET Core applications with Consul
66
Winton.Extensions.Configuration.Consul
Provides support for configuring .NET Core applications with Consul
78
Winton.Extensions.Configuration.Consul
Provides support for configuring .NET Core applications with Consul
81
Winton.Extensions.Configuration.Consul
Provides support for configuring .NET Core applications with Consul
82
Winton.Extensions.Configuration.Consul
Provides support for configuring .NET Core applications with Consul
91
Winton.Extensions.Configuration.Consul
Provides support for configuring .NET Core applications with Consul
10,054

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

.NET Framework 4.6.2

.NET Standard 2.1

.NET Standard 2.0

.NET 9.0

.NET 8.0

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