title: ASP.NET AJAX returning JSON but not recognised as JSON
body: <p>I have this function to get me back a list of managers</p>
  
  <pre><code>function getManagers() {
     var jqxhr = $.ajax({
                     type: 'POST',
                     contentType: "application/json; charset=utf-8",
                     url: '/webservice.asmx/GetManagers',
                     dataType: 'json'
                 }).success(function(data) {
                     var options = '&lt;option selected="selected" disabled="disabled"&gt;Select Manager&lt;/option&gt;';
                     for (var i = 0; i &lt; data.length; i++) {
                         options += '&lt;option value="' + data[i].PostRef + '"&gt;' + data[i].Description + '&lt;/option&gt;';
                     }
                     $('#ReceivingCellManager').html(options);
                 }).error(function(data) {
                     $('.ErrorText').html('Manager load failed please refresh page with F5');
                     $("#errormessage").dialog('open');
                 }).complete(function() {
             });
  } 
  </code></pre>
  
  <p>as you can see I am using JQuery and want to popoulate a drop down list with the available managers</p>
  
  <p>the method within my service looks like this</p>
  
  <pre><code>    [WebMethod]
      [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
      public void GetManagers()
      {
          using (var context = new ConcessionModel())
          {             
              var rcm = Business.GetManager();
              var serializer = new JavaScriptSerializer();
              var response = rcm.Count() != 0
                  ? serializer.Serialize(rcm)
                  : serializer.Serialize(new Error { Code = "500", Message = "Manager Retrieval Failed" });
              this.Context.Response.Clear();
              this.Context.Response.ContentType = "application/json";
              this.Context.Response.Write(response);
          }
      }
  </code></pre>
  
  <p>When the method is called I recieve a response of <strong>200 OK</strong> and the response contains the JSON I want the problem I am having is that the response is not being recognised as JSON.</p>
  
  <p><strong>I HAVE TRIED</strong></p>
  
  <ul>
  <li>adding <strong>dataType</strong> to the ajax call as you can see above</li>
  <li>removing <strong>this.Context.Response.flush</strong> from the end of the response, this cured an error I was getting with adjusting headers after they were sent.</li>
  <li>adding a response format to the method</li>
  <li>adding a <strong>Response.ContentType</strong> to the Context
  These have all failed to get me the required recognition of the JSON. Any help would be much appreciated.</li>
  </ul>
  
  <p><strong>UPDATE: JSON FORMAT</strong></p>
  
  <p>{"Description":"data","Code":"data","reference":"data"}</p>
  
  <p><strong>UPDATE JSON RESPONSE</strong>
  I am seeing something weird in the response my response is as follows</p>
  
  <pre><code>[{"Description":"data","Code":"data","reference":"data"}]{"d":null}
  </code></pre>
  
  <p>I am not sure what the <strong>d null</strong> object is</p>