How to use Newtonsoft.Json as default in Asp.net Core Web Api?

后端 未结 3 1413
予麋鹿
予麋鹿 2020-11-30 07:19

I am new to ASP.Net Web Api Core. I have been using ASP.Net MVC for past few years and I always have written an ActionFilter a

3条回答
  •  再見小時候
    2020-11-30 08:08

    ASP.NET Core already uses JSON.NET as JavaScriptSerializer isn't implemented/ported to .NET Core.

    Microsoft.AspNetCore.Mvc depends on Microsoft.AspNetCore.Formatter.Json which depends on Microsoft.AspNetCore.JsonPatch, which depends on Newtonsoft.Json (see source).

    Update

    This is only true for ASP.NET Core 1.0 to 2.2. ASP.NET Core 3.0 removes the dependency on JSON.NET and uses it's own JSON serializer.

提交回复
热议问题