title: Can I return JSON from an .asmx Web Service if the ContentType is not JSON?
body: <p>I would like to post a form using ajax and jquery to a .asmx webservice and return the value from the webservice as JSON. </p>
  
  <p>I'm using ASP.NET 4.0. I know that in order to return JSON from a webservice the following needs to be set (1) dataType: "json" (2) contentType: "application/json; charset=utf-8", (3) type: "POST" (4) set the Data to something. I have tested this and it works fine (i.e. my webservice returns the data as JSON) <strong>if all **four</strong> are set**.</p>
  
  <p>But, lets say in my case I want to do a standard form post i.e. test1=value1&amp;test2=value2
  so the contentType is not JSON but I want back JSON {test1:value1}. This doesn't seem to work because the contentType is "<strong>application/x-www-form-urlencoded</strong>" not "<strong>application/json; charset=utf-8</strong>".</p>
  
  <p>Can anyone tell me why I can't do this? It seems crazy to me that you have to explicitly
  send JSON to get JSON back, yet if you don't use JSON (i.e. post urlencoded contenttype) then the webservice will return XML.</p>
  
  <p>Any insights are greatly appreciated :)</p>