I'm trying to perform some JSONConvert serializing, and I've ran into a brick wall. All my relevant objects are subclasses from a certain class, say class Super. A subclass of Super can have other Super-inherited members in the class, i.e.
public abstract class Super{}
public class Foo : Super{}
public class Bar : Super {
public Foo foo;
}
My goal is that, when this is serialized, a custom JsonConverter is ran for all these members in order to prepare them individually for serialization,i.e. remove unnecessary data depending on the data inside the object. I've tried using the [JsonConverter] tag on the abstract class, which causes StackOverflowException.
Whenever I try to use a custom serializer it only runs for the parent object and none of the child attributes, so it doesn't allow,in this case, the 'foo' variable the possibility to be processed for serialization. It shouldn't run for non-Super properties either.
Is such a converter possible for JsonConvert? I've been looking around a lot, but haven't found anything like this.
Thanks.