JSON.NET comes with property attributes like [JsonIgnore]
and [JsonProperty]
.
I want to create some custom ones that get run when the seria
Not sure if this is new, but I would suggest using the method GetSerializableMembers
which handles the member infos directly. This way, one can avoid having to deal with the JsonProperty.
public class MyJsonContractResolver : DefaultContractResolver
{
protected override List GetSerializableMembers(Type objectType)
{
return base.GetSerializableMembers(objectType)
.Where(mi => mi.GetCustomAttribute() != null)
.ToList();
}
}