在运行时排除Json序列化中的属性 [英] exclude properties in Json serialization at runtime

查看:66
本文介绍了在运行时排除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序列化中的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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