JavaScriptSerializer. How to ignore property
https://docs.microsoft.com/dotnet/api/system.web.script.serialization.scriptignoreattribute
Use [ScriptIgnore]
using System;
using System.Web.Script.Serialization;
public class Group
{
// The JavaScriptSerializer ignores this field.
[ScriptIgnore]
public string Comment;
// The JavaScriptSerializer serializes this field.
public string GroupName;
}
Best possible answer I have is to make your own JavaScriptConverter and parse the property based on your own condition(s).
public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
{
//...
if (!object.ReferenceEquals(dictionary["MyProperty"],null)){
// My Code
}
//...
}
I used internal instead of public properties and it worked for me