How to serialize only inherited properties of a class using a JsonConverter
问题 I'm trying to serialize only the inherited properties of a class using json.net. I'm aware of the [JsonIgnore] attribute, but I only want to do ignore them on certain occasion, so I used a custom JsonConverter instead. Here's my class: public class EverythingButBaseJsonConverter : JsonConverter { public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { // Find properties of inherited class var classType = value.GetType(); var classProps = classType