I have a custom JSON formatter that removes the time stamp from a DateTime value. The following is the code:
var isoJson = JsonConvert.SerializeObject(value, new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd" });
return isoJson;
When I use that formatter, the string is serialized twice by the above formatter and because of JSON.Net formatter in my WebApiConfig file. The following is the code for the JSON.Net formatter:
config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));
When I remove the JSON.Net formatter and use my custom one, the JSON is serialized once but it is embedded in XML.
How do I remove the JSON.Net formatter and use my custom formatter without having my JSON embedded in XML?