更改JSON.NET序列化属性名称的方式

问题描述:

如何更改Newtonsoft JSON.NET序列化对象属性名称的方式?

How can I change the way Newtonsoft JSON.NET serializes property names of objects?

几种方法:

  1. 您可以使用JsonTextWriter类手动控制其序列化方式:
  1. You can manually control how it serializes using the JsonTextWriter class:
    • http://james.newtonking.com/projects/json/help/index.html?topic=html/ReadingWritingJSON.htm
  • http://james.newtonking.com/projects/json/help/index.html?topic=html/T_Newtonsoft_Json_JsonConverter.htm
  • Example: JSON.NET customizing the serialization to exclude a property name