an easy way to serialise c# objects

不问归期 提交于 2020-01-17 03:14:14

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/6746770/an-easy-way-to-serialise-c-sharp-objects

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!