You can use:
[JsonIgnore] [XmlIgnore]
They will hide your property from both types of serialization. I always tried to mix both in one class, but JSonIgnoreAtrribute is a private class and does not leave us with the possibility of seamless integration.
So the direct way is to add both attributes to your ignorant property.
source share