return Request.CreateResponse(object); in webapi and the request has the contentType header set to
This is all well and good but sometimes we want to controll how it serializes objects.
But what if we want to use a mapper such as knockoutJSs ko.mapping that takes data and returns the same object but with observable proeprties, we could run a constructor/factory before this, or we could fork the mapping source and build our own. Or we could use the Json.NET
JsonProperty attribute that can be applied to properties.
The JsonProperty lives in the Newtonsoft.Json namespace
I sometimes want the text value of my Enums to be serialized instead of the integer value
This can be accomplished by adding another attribute to the property.
The JsonConverter lives in the Newtonsoft.Json namespace
And yes, these can be stacked
How about a list of enums as string?
We are now down to only using the
JsonProperty attribute again.