title: ASP.NET web service erroneously returns XML instead of JSON
body: <p>I'm attempting to use an ASMX web service from javascript using jQuery. It works fine when I ask for XML, but I want to make use of .net's JSON serialization functionality; (it's also starting to bug me that this isn't working)</p>
  
  <p>The code for the web service:</p>
  
  <pre><code>using System;
  using System.Web;
  using System.Web.Services;
  using System.Web.Services.Protocols;
  using System.Web.Script.Services;
  
  [WebService()]
  [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
  [ScriptService]
  public class SimpleService : WebService
  {
      [WebMethod]
      public String GetString()
      {
          return "value";
      }
  }
  </code></pre>
  
  <p>The code for the client:</p>
  
  <pre><code>$.ajax({
    type: "POST",
    url: "SimpleService.asmx/GetString",
    data: "{}",
    contentType: "application/json; charset=utf-8",
    dataType: "json"
  });
  </code></pre>
  
  <p>And the response...</p>
  
  <pre><code>Content-Type: text/xml; charset=utf-8
  Server: Microsoft-IIS/7.5
  X-AspNet-Version: 2.0.50727
  X-Powered-By: ASP.NET
  
  &lt;?xml version="1.0" encoding="utf-8"?&gt;&lt;string xmlns="http://tempuri.org/"&gt;value&lt;/string&gt;
  </code></pre>
  
  <p>The request always succeeds, but jQuery gives me a parser error (not surprisingly, given the response).</p>
  
  <p>I'm at my wits end. I've tried adding a ServiceMethod attribute with the ResponseType set to JSON, but nothing seems to work.</p>
  
  <p>I don't want to use the .NET ScriptManager javascript generator either, so please do not suggest using them.</p>