title: Selectively disable XML Formatter in ASP.NET Web API
body: <p>In ASP.NET Web API, I need to force XML output for a single method but leave the JSON formatter enabled for others. Everything that I have seen on the topic has suggested removing the JSON formatter from the GlobalConfiguration as follows:</p>
  
  <pre class="lang-cs prettyprint-override"><code>// remove JSON formatter
  var formatters = GlobalConfiguration.Configuration.Formatters;
  formatters.Remove(formatters.JsonFormatter);
  </code></pre>
  
  <p>This works but disables JSON output application wide. I need to be able to specify a formatter for a specific method or controller without affecting the global configuration. Is this possible or can it only be done via the GlobalConfiguration?</p>