Using Serializable attribute on Model in WebAPI
I have the following scenario: I am using WebAPI and returning JSON results to the consumer based on a model. I now have the additional requirement to serialize the models to base64 to be able to persist them in cache and/or use them for auditing purposes. Problem is that when I add the [Serializable] attribute to the model so for converting the the model to Base64, the JSON output changes as follows: The Model: [Serializable] public class ResortModel { public int ResortKey { get; set; } public string ResortName { get; set; } } Without the [Serializable] attribute the JSON output is: {