这篇文章上次修改于 930 天前,可能其部分内容已经发生变化,如有疑问可询问作者。
升级后默认的
Json
序列化器变成了System.Text.Json
,之前默认是Newtonsoft.Json
。Newtonsoft.Json
中的JsonProperty
现在相应的要使用JsonPropertyName
才会生效。如果想换回
Newtonsoft.Json
可按如下步骤:dotnet add package Microsoft.AspNetCore.Mvc.NewtonsoftJson
- 在
Startup
的ConfigureServices
中services.AddControllers().AddNewtonsoftJson();
没有评论