Skip to content

Instantly share code, notes, and snippets.

@aikmeng
Created September 27, 2013 23:17
Show Gist options
  • Save aikmeng/6736534 to your computer and use it in GitHub Desktop.
Save aikmeng/6736534 to your computer and use it in GitHub Desktop.
MVC Web API to return JSON values by default. This will still support xml request.
var appXmlType = config.Formatters.XmlFormatter.SupportedMediaTypes.FirstOrDefault(t => t.MediaType == "application/xml");
config.Formatters.XmlFormatter.SupportedMediaTypes.Remove(appXmlType);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment