Microsoft.Extensions.Configuration.Json 9.0.3

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
83
EPPlus
A spreadsheet library for .NET framework and .NET core
86
EPPlus
A spreadsheet library for .NET framework and .NET core
1,892
EPPlus
Create advanced Excel spreadsheets using .NET
82
EPPlus
Create advanced Excel spreadsheets using .NET
2,067
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.
75
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.
81
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. This package was built from the source at: https://github.com/aspnet/Universe/tree/1016eae4004686f7fdad13f5c329f63bbae1f3a1
71
Microsoft.Extensions.Configuration.UserSecrets
User secrets configuration provider implementation for Microsoft.Extensions.Configuration.
74
Microsoft.Extensions.Configuration.UserSecrets
User secrets configuration provider implementation for Microsoft.Extensions.Configuration.
86
TNE.Common
Package Description
10,363
Winton.Extensions.Configuration.Consul
Provides support for configuring .NET Core applications with Consul
72
Winton.Extensions.Configuration.Consul
Provides support for configuring .NET Core applications with Consul
73
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
90
Winton.Extensions.Configuration.Consul
Provides support for configuring .NET Core applications with Consul
93
Winton.Extensions.Configuration.Consul
Provides support for configuring .NET Core applications with Consul
96
Winton.Extensions.Configuration.Consul
Provides support for configuring .NET Core applications with Consul
105
Winton.Extensions.Configuration.Consul
Provides support for configuring .NET Core applications with Consul
10,350

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

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