As the title says, I want to mark a property as non serializable by the JavascriptSerializer. How can achive that ? Thanks in advance.
You can prevent member variables from being serialized by marking them with the NonSerialized attribute as follows. If possible, make an object that could contain security-sensitive data nonserializable. If the object must be serialized, apply the NonSerialized attribute to specific fields that store sensitive data.
To ignore individual properties, use the [JsonIgnore] attribute.
Apply a [JsonIgnore] attribute to the property that you do not want to be serialized.
I think you just want to apply the ScriptIgnoreAttribute
:
[ScriptIgnore]
public string IgnoreThis { get; set; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With