If I have an object that I return from WebApi, is it possible to mark one of the properties as hidden ?
1 Answer
You can use:
[JsonIgnore]
[XmlIgnore]
These will hide your property from both kinds of serialization.
I have always tried to mix both in a single class but JSonIgnoreAtrribute is a sealed class and does not leave us with a seamless integration option.
So the straight forward way is to add both attributes on your ignorable property.