When developing .NET Core 3.1 applications or later, you may notice that Microsoft has changed to use the default dependency to System.Text.Json. The new serializer is very lightweight, but is still maturing. So, you may find that you need to add Newtonsoft JSON back in. To do this, we’ll first need to add a reference to the package by either running:

Install-Package Microsoft.AspNetCore.Mvc.NewtonsoftJson


dotnet add package Microsoft.AspNetCore.Mvc.NewtonsoftJson

Then, update the ConfigureServices method by adding AddNewtonsoftJson() to AddControllers() like so:

AddNewtonsoftJson to AddControllers