services.AddControllers().AddNewtonsoftJson();

Using Newtonsoft.Json In .NET Core 3+ Projects - .NET Core Tutorials