Tuesday, February 25, 2020

The JSON value could not be converted to System.Collections.Generic.IEnumerable`1[Newtonsoft.Json.Linq.JToken]

If you are getting the following error in your .Net Core Project
"The JSON value could not be converted to System.Collections.Generic.IEnumerable`1[Newtonsoft.Json.Linq.JToken]"
Then you have to install the "Microsoft.AspNetCore.Mvc.NewtonsoftJson" Nuget package.

Afterwards, in the startup class, update Startup.ConfigureServices to call AddNewtonsoftJson.
Example:

public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews().AddNewtonsoftJson();
  }

No comments:

Post a Comment