这适用于@MaxiWheat和其他对在RestSharp请求中如何使用 JSON.NET
作为JSON序列化程序感兴趣的人。基本上,我使用了Patrick
Riley在此博客文章中描述的方法:
// create the requestvar request = new RestRequest(yourUrlHere, Method.POST) { RequestFormat = DataFormat.Json };// attach the JSON.NET serializer for RestSharprestRequest.JsonSerializer = new RestSharpJsonNetSerializer();并且
RestSharpJsonNetSerializer是JSON.NET专家(John
Sheehan)的实现(少于100行代码),可在其Github页面上找到
通过这种设置,我的问题消失了,我能够拥有一个具有良好CamelCase属性的正确DTO,而序列化JSON在所有“小写字母”中都使用了它们。



