How to exclude some members from being serialized to Json?

前端 未结 3 743
予麋鹿
予麋鹿 2021-01-12 07:45

I have an object that I want to serialize to Json format I\'m using:

    public string ToJson()
    {
        JavaScriptSerializer jsonSerializer = new JavaS         


        
3条回答
  •  情话喂你
    2021-01-12 08:01

    Check out the JavaScriptConverter class. You can register converters to customize the serialization/deserialization process for specific object types. You can then include the properties that you want, without making any changes to the original class.

提交回复
热议问题