JsonResult(object) causes “The collection type 'Newtonsoft.Json.Linq.JToken' is not supported.”

那年仲夏 提交于 2019-12-06 01:39:28

Migrate from ASP.NET Core 2.2 to 3.0

  • Add a package reference to Microsoft.AspNetCore.Mvc.NewtonsoftJson
  • Update Startup.ConfigureServices to call AddNewtonsoftJson
  • services.AddMvc().AddNewtonsoftJson();

@sabiland answer helped me, small changes

  1. added in .csproj reference to NewtonsoftJson, as below

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

  1. adde in Startup.cs, in method ConfigureServices, AddMvcCore

    services.AddMvcCore()
            .AddNewtonsoftJson();
    
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!