像这样使用 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