title: Is it possible to change the MediaTypeFormatter to JSON for only one class?
body: <p>I have a web api, where the global configuration is configured to use:
  XmlMediaTypeFormatter</p>
  
  <p>My problem is I wont to extend this web api with a new controller, that uses the JsonMediaTypeFormatter instead. </p>
  
  <p>Is it possible to change the MediaTypeFormatter to JSON for only one API Controller class?</p>
  
  <p>My problem is not returning JSON, I have accumplished this with returning HttpResponseMessage:</p>
  
  <pre><code>return new HttpResponseMessage
  {
      Content = new ObjectContent&lt;string&gt;("Hello world", new JsonMediaTypeFormatter()),
      StatusCode = HttpStatusCode.OK
  };
  </code></pre>
  
  <p>It's on the request I get the problem. If I have an object with two properties:</p>
  
  <pre><code>public class VMRegistrant 
  {
      public int MerchantId { get; set; }
      public string Email { get; set; }
  }
  </code></pre>
  
  <p>And my controller action takes the VMRegistrant as argument: </p>
  
  <pre><code>public HttpResponseMessage CreateRegistrant(VMRegistrant registrant)
  {
      // Save registrant in db...
  }
  </code></pre>
  
  <p>But the problem is when I call the action with JSON it fails. </p>