答案 0 :(得分:1)
有两个用于MvcCore JsonOptions的ContractResolver(PascalCasing和camelCasing)。如果需要CamelCase,则必须将MVC MiddleWare设置为:
public void ConfigureServices(IServiceCollection services)
{
...
services.AddMvc()
.AddJsonOptions(options =>
{
options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
});
...
}
答案 1 :(得分:0)
用于帕斯卡保护套
只需将这段代码添加到Startup.cs
public void ConfigureServices(IServiceCollection services)
{
...
services.AddMvc()
.AddJsonOptions(options =>
{
options.SerializerSettings.ContractResolver = new DefaultContractResolver();
});
...
}