其他分享
首页 > 其他分享> > Web Api 返回参数,实现统一标准化!

Web Api 返回参数,实现统一标准化!

作者:互联网

string camelCaseObj = JsonConvert.SerializeObject(data,
                                     Newtonsoft.Json.Formatting.None,
                                     new JsonSerializerSettings()
                                     {
                                         NullValueHandling = NullValueHandling.Ignore,
                                         ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
                                         ContractResolver = new CamelCasePropertyNamesContractResolver()
                                     }); //--驼峰格式的命名规范
camelCaseObj= camelCaseObj.ToLower();    //--全部小写的命名规范
var jsonConvertCommonData = JsonConvert.DeserializeObject(camelCaseObj);

 

转载于:https://www.cnblogs.com/Kummy/p/3758469.html

标签:Web,NullValueHandling,camelCaseObj,标准化,JsonConvert,Api,new,Ignore,ReferenceLoopH
来源: https://blog.csdn.net/weixin_34219944/article/details/93230617