Json.Net的自定义类型序列化器 [英] Custom type serializer for Json.Net
本文介绍了Json.Net的自定义类型序列化器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用NewtonSoft Json.Net将对象序列化为JSON.我的课程中的一个没有正确序列化.我想知道是否有可能构建将输出不同JSON的自定义类型序列化器.
I'm using NewtonSoft Json.Net to serialize my objects to JSON. On of my classes is not serializing correctly. I was wondering if it is possible to build a custom type serializer that will output different JSON.
如何为特定的类创建自定义的序列化器/反序列化器?
How can I make a custom serializer/deserializer for a specific class?
推荐答案
,您可以创建自己的自定义JsonConverter 并实现其ReadJson和WriteJson方法.
you may create your own Custom JsonConverter and implement its ReadJson and WriteJson methods.
这篇关于Json.Net的自定义类型序列化器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文