Ignore Base Class Properties in Json.NET Serialization

Most simple way to do it is simply decorate the AxisAlignedRectangle object with [JsonObject(MemberSerialization.OptIn)].

In a sentence, it will serialize only properties decorated with [JsonProperty] attribute.
You can read more here: MemberSerialization Enumeration.

Another option is to decorate the Polygon properties with JsonIgnoreAttribute Class.

Leave a Comment