更改JSON.NET序列化属性名称的方式 [英] Change the way JSON.NET serializes property names

查看:129
本文介绍了更改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

这篇关于更改JSON.NET序列化属性名称的方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆