【发布时间】:2013-05-04 12:33:53
【问题描述】:
像这样使用 JSON.Net:
JsonConvert.SerializeObject(someObject,
Newtonsoft.Json.Formatting.None,
new JsonSerializerSettings() {
NullValueHandling = NullValueHandling.Ignore,
ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
ContractResolver = new CamelCasePropertyNamesContractResolver()
});
JSON.Net 做了多少驼峰式?
它只是从单词的开头开始的小写字母吗?
例子:
- somePropertyId -> somePropertyId
- somePropertyID -> somePropertyID
- SOMEPropertyID -> somePropertyID
- SOMEPROPERTYID -> somepropertyid
【问题讨论】:
-
为什么不试试看呢?制作一个快速的一次性控制台应用程序来测试这种行为应该很容易。
标签: serialization json.net camelcasing jsonserializer sanity-check