To write this article I was using this web site.

First create JSON configuration file, in my case I did it like this:

Right click on file, and click properties:

Set "Copy to Output Directory", in my case I have set it to "Copy always":

Add following references:

Microsoft.Extensions.Configuration
Microsoft.Extensions.Configuration.FileExtensions
Microsoft.Extensions.Configuration.Json

In my case I have added them with NuGet:

Or you can add them via console:

dotnet add package Microsoft.Extensions.Configuration
dotnet add package Microsoft.Extensions.Configuration.FileExtensions
dotnet add package Microsoft.Extensions.Configuration.Json

In my case my JSON configuration file looks like this:

{
"apiKey":  "myApiKey"
}
Code:
using Microsoft.Extensions.Configuration;
using System;
using System.IO;

namespace jsonConfigurationFile
{
  class Program
  {
    static void Main(string[] args)
    {
      IConfiguration config = new ConfigurationBuilder()
          .AddJsonFile("jsconfig1.json", true, true)
          .Build();

      Console.WriteLine($" Key: { config["apiKey"] }");
      Console.ReadKey();
    }
  }
}