Microsoft.Extensions.Configuration.Json 9.0.0-rc.1.24431.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.

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
55
EPPlus
A spreadsheet library for .NET framework and .NET core
1,759
EPPlus
Create advanced Excel spreadsheets using .NET
1,961
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.
55
Microsoft.Extensions.Configuration.UserSecrets
User secrets configuration provider implementation for Microsoft.Extensions.Configuration.
51
Microsoft.Extensions.Configuration.UserSecrets
User secrets configuration provider implementation for Microsoft.Extensions.Configuration.
52
Microsoft.Extensions.Configuration.UserSecrets
User secrets configuration provider implementation for Microsoft.Extensions.Configuration.
54
Microsoft.Extensions.Configuration.UserSecrets
User secrets configuration provider implementation for Microsoft.Extensions.Configuration.
56
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.
62
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.
52
TNE.Common
Package Description
9,842
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
61
Winton.Extensions.Configuration.Consul
Provides support for configuring .NET Core applications with Consul
70
Winton.Extensions.Configuration.Consul
Provides support for configuring .NET Core applications with Consul
71
Winton.Extensions.Configuration.Consul
Provides support for configuring .NET Core applications with Consul
75
Winton.Extensions.Configuration.Consul
Provides support for configuring .NET Core applications with Consul
83
Winton.Extensions.Configuration.Consul
Provides support for configuring .NET Core applications with Consul
9,833

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