序列化C#对象的简单方法 [英] an easy way to serialise c# objects
本文介绍了序列化C#对象的简单方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Newtonsoft.Json将json转换为对象,效果很好.我想知道是否有一个很好的方法来逆转该过程,并指出我不想对所有对象字段进行jsonise处理.换句话说,有没有一种方法可以使用Newtonsoft.Json来生成细化的jsonized对象表示形式?
I'm using Newtonsoft.Json to turn json into objects, that works fine. I was wondering if there's a nice way to reverse the process noting that i dont want to jsonise all the object fields. To paraphrase, is there a way to use Newtonsoft.Json to produce thinned down jsonised object representations?
推荐答案
Have you tried using the JsonIgnore
to opt-out properties that you don't want to be included in the JSON serialization? See this topic:
http://james.newtonking.com/projects/json/help/ReducingSerializedJSONSize.html
这篇关于序列化C#对象的简单方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文