title: MVC 4 - Web Api and JSON?
body: <p>I'm ramping up on MVC 4's Web API and I'm a bit confused about the default formatting. I want the API data to be in JSON. However, it's returning it in XML. According to the MVC 4 getting started video at <a href="http://www.asp.net/web-api/videos/getting-started/your-first-web-api" rel="noreferrer">http://www.asp.net/web-api/videos/getting-started/your-first-web-api</a>, it should be JSON by default. But when I create a new Web Api project and run the sample, I get this:</p>
  
  <pre><code>&lt;ArrayOfstring&gt;&lt;string&gt;value1&lt;/string&gt;&lt;string&gt;value2&lt;/string&gt;&lt;/ArrayOfstring&gt;
  </code></pre>
  
  <p>I've been running around in circles trying to get this in JSON but apparently there is a lot of misinformation about this. Such as:</p>
  
  <ol>
  <li>If I add "application/json" to the content type header, it should return JSON. This doesn't work, but I'm suspecting I don't have the header variable name right as I'm not finding the exact name to use. I've tried "Content-Type" and "contentType" in the request headers with no luck. Besides, I want JSON by default, not according to header info.</li>
  <li>If I create a JsonFormatter and add it in Application_Start <code>GlobalConfiguration.Configuration.Formatters.Insert(0, new JsonNetFormatter(serializerSettings));</code> It should do the trick. But I gathered this depreciated as none of the examples are working.</li>
  </ol>
  
  <p>What could I do, something simple preferably, to output data in JSON format by default?</p>