引入包Microsoft.AspNetCore.Mvc.NewtonsoftJson
然后在 Startup.cs 的ConfigureServices方法中加入
builder.Services.AddControllers().AddNewtonsoftJson(options =>{options.SerializerSettings.ContractResolver = new DefaultContractResolver();});
Powered by: 博客园 Copyright © 2024 一佳一 Powered by .NET 8.0 on Kubernetes