Is there a way to configure Json.NET to not serialize properties which have an [Obsolete] attribute?
e.g.
public class Foo
{
public int Id { get; set; }
[Obsolete]
public int Age { get; set; }
}
var foo = new Foo { Id = 123, Age = 23 };
var json = JsonConvert.SerializeObject(foo);
In the above example, the json is {"Id":123,"Age":23}
I would like {"Id":123}