A bit similar question but the answer does not make sense here
public static void Main(string[] args)
{
var myObject = new ChildClass()
{
P1 = "p1",
P2 = "P2",
};
var data = (ParentClass)myObject;
var jsonData = Newtonsoft.Json.JsonConvert.SerializeObject(data);
Console.WriteLine(jsonData);
}
class ParentClass
{
public string P1 { get; set; }
}
class ChildClass : ParentClass
{
public string P3 { get; set; }
}
would return
{"P2":"P2","P1":"p1"}
using JsonIgnore on the base or child class does not make sense, since I like the process work as normal for all other normal cases.