Use Newtonsoft.Json in .NET Core 3 Web Api

October 22, 2020 .net .netcore

This post is mostly just distilling information I got from .NET Core Tutorials to revert back to Newtonsoft.Json in core WebApi.

In your csproj add the PackageReference:

    <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.9" />

And then in the ConfigureServices of the Startup class add the .AddNewtonsoftJson() after the call to .AddControllers():

public void ConfigureServices(IServiceCollection services)