Thursday, August 25, 2016

ASP.NET Web API: Remove XML formatter

ASP.NET Web API supports the concept of media formatters. Based on the content-type you set in your request headers different output can be generated. Default formatters exist for XML and JSON.

However I had a situation where I only wanted to return JSON output. Removing the XML formatter can easily be done through the Web API configuration inside your startup.cs file:

No comments: