In this article I will explain with an example, how to configure Newtonsoft library in ASP.Net Core.
Note: For beginners in ASP.Net Core MVC, please refer my article ASP.Net MVC Core Hello World Tutorial with Sample Program example.

Installing Newtonsoft package using Nuget

In order to install Newtonsoft library using Nuget, please refer my article Installing Newtonsoft library using Nuget.

Configuring Newtonsoft library

In order to configure Newtonsoft library in ASP.Net Core, please follow the below steps.
1. Open the Startup.cs file from the Solution Explorer window.
Configuring Newtonsoft library in ASP.Net Core
2. Inherit the following namespace.
using Newtonsoft.Json.Serialization;
3. Then, inside the ConfigureServices method, you will have to add the following code which will instruct the program to use Newtonsoft library for JSON serialization.
public void ConfigureServices(IServiceCollection services)
            .AddJsonOptions(options => options.SerializerSettings.ContractResolver = new DefaultContractResolver());

Other available versions