title: JSON invalid according to jQuery but not JSONlint
body: <p>I have a .NET web service returning the following JSON:</p>
  
  <pre><code>{"command":"getqcardjson","valuesets":[{"datatable":"eaa65990-8f88-45e0-966b-610858ad4cb6","values":[{"Id":"eaa65990-8f88-45e0-966b-610858ad4cb6","InternalName":"Alpha Profile","TableName":"Alpha Profile","OnMainMenu":"","DefaultDataSourceId":"bb4d1622-2e48-40b6-bea7-6355d701445c","DefaultOrder":"100","IsChained":"","IncludeInGlobalSearch":"False","IsModelObject":"","IsSchemaObject":"","IsSecured":"False","IsFileNewMenu":"False","IsUpdateShouldRippleCache":"False","AdvancedSearchQueryId":"","CompoundViewQueryId":"","GlobalSearchQueryId":"","Icon":"Information.png","DefaultObjectLayoutStyle":"980163c2-2688-465d-9383-e5ad4dbf631f","Notes":"This is a test Enquiry profile object called Alpha Profile","Caption":"Alpha Profile","IsProfileObject":"True","ShortCacheQueryId":"","WorkflowForCreation":"","IsAllowNewFromExisting":"","IsGeocodable":""},{"Id":"2cbc4bc4-7db0-4344-b49a-bbc8ed4e9e60","InternalName":"CompMP","TableName":"CompMP","OnMainMenu":"True","DefaultDataSourceId":"bb4d1622-2e48-40b6-bea7-6355d701445c","DefaultOrder":"100","IsChained":"","IncludeInGlobalSearch":"False","IsModelObject":"False","IsSchemaObject":"False","IsSecured":"","IsFileNewMenu":"False","IsUpdateShouldRippleCache":"","AdvancedSearchQueryId":"","CompoundViewQueryId":"","GlobalSearchQueryId":"","Icon":"profile.png","DefaultObjectLayoutStyle":"980163c2-2688-465d-9383-e5ad4dbf631f","Notes":"","Caption":"CompMP","IsProfileObject":"True","ShortCacheQueryId":"","WorkflowForCreation":"","IsAllowNewFromExisting":"","IsGeocodable":""},{"Id":"f33038ce-2a64-4e79-99fc-ad6aaf90c2bb","InternalName":"ContactProfile","TableName":"ContactProfile","OnMainMenu":"True","DefaultDataSourceId":"bb4d1622-2e48-40b6-bea7-6355d701445c","DefaultOrder":"100","IsChained":"","IncludeInGlobalSearch":"False","IsModelObject":"False","IsSchemaObject":"False","IsSecured":"","IsFileNewMenu":"False","IsUpdateShouldRippleCache":"","AdvancedSearchQueryId":"","CompoundViewQueryId":"","GlobalSearchQueryId":"","Icon":"profile.png","DefaultObjectLayoutStyle":"980163c2-2688-465d-9383-e5ad4dbf631f","Notes":"","Caption":"ContactProfile","IsProfileObject":"True","ShortCacheQueryId":"","WorkflowForCreation":"","IsAllowNewFromExisting":"","IsGeocodable":""},{"Id":"fbb39ed3-0409-4712-b6dd-f6853b079aa6","InternalName":"QCardInqMP","TableName":"QCardInqMP","OnMainMenu":"True","DefaultDataSourceId":"bb4d1622-2e48-40b6-bea7-6355d701445c","DefaultOrder":"100","IsChained":"","IncludeInGlobalSearch":"False","IsModelObject":"False","IsSchemaObject":"False","IsSecured":"","IsFileNewMenu":"False","IsUpdateShouldRippleCache":"","AdvancedSearchQueryId":"","CompoundViewQueryId":"","GlobalSearchQueryId":"","Icon":"profile.gif","DefaultObjectLayoutStyle":"980163c2-2688-465d-9383-e5ad4dbf631f","Notes":"","Caption":"QCardInqMP","IsProfileObject":"True","ShortCacheQueryId":"","WorkflowForCreation":"","IsAllowNewFromExisting":"","IsGeocodable":""},{"Id":"41db39fb-fda8-4c5c-adc4-6e6c1ba77b90","InternalName":"QCEventAttendance","TableName":"QCEventAttendance","OnMainMenu":"True","DefaultDataSourceId":"bb4d1622-2e48-40b6-bea7-6355d701445c","DefaultOrder":"","IsChained":"","IncludeInGlobalSearch":"","IsModelObject":"","IsSchemaObject":"","IsSecured":"","IsFileNewMenu":"","IsUpdateShouldRippleCache":"","AdvancedSearchQueryId":"","CompoundViewQueryId":"","GlobalSearchQueryId":"","Icon":"","DefaultObjectLayoutStyle":"","Notes":"","Caption":"Attendance details","IsProfileObject":"True","ShortCacheQueryId":"","WorkflowForCreation":"","IsAllowNewFromExisting":"","IsGeocodable":""},{"Id":"8f186be5-d0ec-4dc7-bfd5-9b9190644c1f","InternalName":"QCFilms","TableName":"QCFilms","OnMainMenu":"True","DefaultDataSourceId":"bb4d1622-2e48-40b6-bea7-6355d701445c","DefaultOrder":"","IsChained":"","IncludeInGlobalSearch":"False","IsModelObject":"","IsSchemaObject":"","IsSecured":"False","IsFileNewMenu":"False","IsUpdateShouldRippleCache":"False","AdvancedSearchQueryId":"","CompoundViewQueryId":"","GlobalSearchQueryId":"","Icon":"","DefaultObjectLayoutStyle":"2b69073c-4035-4597-acc0-4d8345ba9d1c","Notes":"","Caption":"QCFilms","IsProfileObject":"True","ShortCacheQueryId":"","WorkflowForCreation":"","IsAllowNewFromExisting":"False","IsGeocodable":"False"}]}]}
  </code></pre>
  
  <p>My client code is as follows:</p>
  
  <pre><code>$('#panelMiddle').append('Getting Json');
      var url = "svc.asmx/GetJSONData?command=getqcardjson&amp;qcardid=" + QCardId;
      $.ajax({
          url: url,
          dataType: 'json',
          success: function(data) {
              $('#panelMiddle').append('Success');
          },
          complete: function() {
              $('#panelMiddle').append('Completed');
          },
          error: function(XMLHttpRequest, textStatus, errorThrown) {
          $('#panelMiddle').append(' #ERROR:' + textStatus + '# ' + errorThrown + ' ');
          }
  
      });
  </code></pre>
  
  <p>If I paste the returned JSON into <a href="http://www.jsonlint.com/" rel="nofollow">http://www.jsonlint.com/</a> then it validates, but the jQuery AJAX call errors with textStatus="parsererror" and errorThrown="Invalid JSON".  My web svc is defined as follows:</p>
  
  <pre><code>[WebMethod(EnableSession = true)] // Required to create web service, even when json decoration present
      [ScriptMethod(UseHttpGet = true,ResponseFormat = ResponseFormat.Json)] // Required decoration to ensure we can call using json
      public string GetJSONData(string command)
      { 
  </code></pre>
  
  <p>Anyone know whats going on?  Thanks.</p>
  
  <p>Firefox console response shows as follows:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;string xmlns="http://highpersoft.com/"&gt;{"command":"getqcardjson","valuesets":[{"datatable":"eaa65990-8f88-45e0-966b-610858ad4cb6","values":[{"Id":"eaa65990-8f88-45e0-966b-610858ad4cb6","InternalName":"Alpha Profile","TableName":"Alpha Profile","OnMainMenu":"","DefaultDataSourceId":"bb4d1622-2e48-40b6-bea7-6355d701445c","DefaultOrder":"100","IsChained":"","IncludeInGlobalSearch":"False","IsModelObject":"","IsSchemaObject":"","IsSecured":"False","IsFileNewMenu":"False","IsUpdateShouldRippleCache":"False","AdvancedSearchQueryId":"","CompoundViewQueryId":"","GlobalSearchQueryId":"","Icon":"Information.png","DefaultObjectLayoutStyle":"980163c2-2688-465d-9383-e5ad4dbf631f","Notes":"This is a test Enquiry profile object called Alpha Profile","Caption":"Alpha Profile","IsProfileObject":"True","ShortCacheQueryId":"","WorkflowForCreation":"","IsAllowNewFromExisting":"","IsGeocodable":""},{"Id":"2cbc4bc4-7db0-4344-b49a-bbc8ed4e9e60","InternalName":"CompMP","TableName":"CompMP","OnMainMenu":"True","DefaultDataSourceId":"bb4d1622-2e48-40b6-bea7-6355d701445c","DefaultOrder":"100","IsChained":"","IncludeInGlobalSearch":"False","IsModelObject":"False","IsSchemaObject":"False","IsSecured":"","IsFileNewMenu":"False","IsUpdateShouldRippleCache":"","AdvancedSearchQueryId":"","CompoundViewQueryId":"","GlobalSearchQueryId":"","Icon":"profile.png","DefaultObjectLayoutStyle":"980163c2-2688-465d-9383-e5ad4dbf631f","Notes":"","Caption":"CompMP","IsProfileObject":"True","ShortCacheQueryId":"","WorkflowForCreation":"","IsAllowNewFromExisting":"","IsGeocodable":""},{"Id":"f33038ce-2a64-4e79-99fc-ad6aaf90c2bb","InternalName":"ContactProfile","TableName":"ContactProfile","OnMainMenu":"True","DefaultDataSourceId":"bb4d1622-2e48-40b6-bea7-6355d701445c","DefaultOrder":"100","IsChained":"","IncludeInGlobalSearch":"False","IsModelObject":"False","IsSchemaObject":"False","IsSecured":"","IsFileNewMenu":"False","IsUpdateShouldRippleCache":"","AdvancedSearchQueryId":"","CompoundViewQueryId":"","GlobalSearchQueryId":"","Icon":"profile.png","DefaultObjectLayoutStyle":"980163c2-2688-465d-9383-e5ad4dbf631f","Notes":"","Caption":"ContactProfile","IsProfileObject":"True","ShortCacheQueryId":"","WorkflowForCreation":"","IsAllowNewFromExisting":"","IsGeocodable":""},{"Id":"fbb39ed3-0409-4712-b6dd-f6853b079aa6","InternalName":"QCardInqMP","TableName":"QCardInqMP","OnMainMenu":"True","DefaultDataSourceId":"bb4d1622-2e48-40b6-bea7-6355d701445c","DefaultOrder":"100","IsChained":"","IncludeInGlobalSearch":"False","IsModelObject":"False","IsSchemaObject":"False","IsSecured":"","IsFileNewMenu":"False","IsUpdateShouldRippleCache":"","AdvancedSearchQueryId":"","CompoundViewQueryId":"","GlobalSearchQueryId":"","Icon":"profile.gif","DefaultObjectLayoutStyle":"980163c2-2688-465d-9383-e5ad4dbf631f","Notes":"","Caption":"QCardInqMP","IsProfileObject":"True","ShortCacheQueryId":"","WorkflowForCreation":"","IsAllowNewFromExisting":"","IsGeocodable":""},{"Id":"41db39fb-fda8-4c5c-adc4-6e6c1ba77b90","InternalName":"QCEventAttendance","TableName":"QCEventAttendance","OnMainMenu":"True","DefaultDataSourceId":"bb4d1622-2e48-40b6-bea7-6355d701445c","DefaultOrder":"","IsChained":"","IncludeInGlobalSearch":"","IsModelObject":"","IsSchemaObject":"","IsSecured":"","IsFileNewMenu":"","IsUpdateShouldRippleCache":"","AdvancedSearchQueryId":"","CompoundViewQueryId":"","GlobalSearchQueryId":"","Icon":"","DefaultObjectLayoutStyle":"","Notes":"","Caption":"Attendance details","IsProfileObject":"True","ShortCacheQueryId":"","WorkflowForCreation":"","IsAllowNewFromExisting":"","IsGeocodable":""},{"Id":"8f186be5-d0ec-4dc7-bfd5-9b9190644c1f","InternalName":"QCFilms","TableName":"QCFilms","OnMainMenu":"True","DefaultDataSourceId":"bb4d1622-2e48-40b6-bea7-6355d701445c","DefaultOrder":"","IsChained":"","IncludeInGlobalSearch":"False","IsModelObject":"","IsSchemaObject":"","IsSecured":"False","IsFileNewMenu":"False","IsUpdateShouldRippleCache":"False","AdvancedSearchQueryId":"","CompoundViewQueryId":"","GlobalSearchQueryId":"","Icon":"","DefaultObjectLayoutStyle":"2b69073c-4035-4597-acc0-4d8345ba9d1c","Notes":"","Caption":"QCFilms","IsProfileObject":"True","ShortCacheQueryId":"","WorkflowForCreation":"","IsAllowNewFromExisting":"False","IsGeocodable":"False"}]}]}&lt;/string&gt;
  </code></pre>
  
  <p>so presumably that's the problem.  Something wrong with my web method declarations above?</p>
  
  <p>Server now doing this:
  {"Message":"Invalid JSON primitive: getqcardjson.","StackTrace":"   at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializePrimitiveObject()\r\n   at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInternal(Int32 depth)\r\n   at System.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize(String input, Int32 depthLimit, JavaScriptSerializer serializer)\r\n   at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit)\r\n   at System.Web.Script.Services.RestHandler.GetRawParamsFromGetRequest(HttpContext context, JavaScriptSerializer serializer, WebServiceMethodData methodData)\r\n   at System.Web.Script.Services.RestHandler.GetRawParams(WebServiceMethodData methodData, HttpContext context)\r\n   at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.ArgumentException"}</p>