在运行时排除Json序列化中的属性

编程入门 行业动态 更新时间:2024-10-28 00:19:35
本文介绍了在运行时排除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序列化中的属性

本文发布于:2023-11-09 20:11:01,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1573309.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:属性   序列化   Json

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!