原文:C#序列化json属性名首字母变成小写的解决方案

//接口返回自动转小写,容易造成前后端不一致,获取不到数据,切换成转驼峰(首字母大写)如Code/Result
//在ConfigureServices中配置ContractResolver
services.AddMvc().AddJsonOptions(options => { options.SerializerSettings.ContractResolver = new DefaultContractResolver(); });
05-11 13:42