本文介绍了在运行时排除Json序列化中的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图通过使用Json序列化程序来避免某些属性的序列化取决于运行时逻辑,我找到了一个java的例子,但是我需要在C#中做到这一点。 如果有人对此有任何线索,我真的很感激。 提前感谢。
hi , I''m trying to avoid serialization of some properties depending on a runtime logic by using Json serializer , I found an example for java , but I need to do this in C#. If anyone has got any clue on this , I really appreciate . thanks in advance.
推荐答案这取决于您使用的序列化程序,对于我的 fastJSON [ ^ ]项目你可以用一个 XmlIgnore 属性。 This really depends on the serializer you use, for my fastJSON[^] project you can do this with a XmlIgnore attribute.
更多推荐
在运行时排除Json序列化中的属性
发布评论