更改JSON.NET序列化属性名称的方式 [英] Change the way JSON.NET serializes property names
本文介绍了更改JSON.NET序列化属性名称的方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何更改Newtonsoft JSON.NET序列化对象属性名称的方式?
How can I change the way Newtonsoft JSON.NET serializes property names of objects?
推荐答案
几种方法:
- 您可以使用
JsonTextWriter
类手动控制其序列化方式:
- 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
- 示例: JSON.NET将序列化自定义为排除属性名称
- 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
这篇关于更改JSON.NET序列化属性名称的方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文