title: Asp.net WebService function doesn't return JSON
body: <p>I've read every post about this issue, but nothing solved the problem.
  I'll be glad if someone can help me with that.</p>
  
  <p>There's an MVC3 project with a web service that I added.
  I have only one function called Test, and when I call it through an HTTP GET method (regular url) , it returns the data with XML format instead of JSON.
  How can I make it return JSON?</p>
  
  <p>The web service:</p>
  
  <pre><code>namespace TestServer
  {
      [WebService]
      [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
      [System.ComponentModel.ToolboxItem(false)]
      [System.Web.Script.Services.ScriptService]
      public class TestWebservice : System.Web.Services.WebService
      {  
          [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
          [WebMethod]
          public List&lt;string&gt; Test()
          {    
              return new List&lt;string&gt;
                  {
                      {"Test1"},
                      {"Test2"}
                  };                    
          }
      }
  }
  </code></pre>
  
  <p>The web.config (only relevant parts):</p>
  
  <pre><code>&lt;configuration&gt;
    &lt;location path="TestWebservice.asmx"&gt;
      &lt;system.web&gt;
        &lt;webServices&gt;
          &lt;protocols&gt;
            &lt;add name="HttpGet"/&gt;
          &lt;/protocols&gt;
        &lt;/webServices&gt;
      &lt;/system.web&gt;
    &lt;/location&gt;  
    &lt;system.web&gt;
      &lt;webServices&gt;
        &lt;protocols&gt;
          &lt;clear/&gt;
        &lt;/protocols&gt;
      &lt;/webServices&gt;
      &lt;httpHandlers&gt;
        &lt;remove verb="*" path="*.asmx"/&gt;
        &lt;add verb="*" path="*.asmx"
          type="System.Web.Script.Services.ScriptHandlerFactory"
          validate="false"/&gt;
      &lt;/httpHandlers&gt;
    &lt;/system.web&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p><br>
  The url:</p>
  
  <pre><code>http://localhost:49740/testwebservice.asmx/Test
  </code></pre>
  
  <p><br>
  The result (which is not what I want):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/"&gt;
    &lt;string&gt;Test1&lt;/string&gt;
    &lt;string&gt;Test2&lt;/string&gt;
  &lt;/ArrayOfString&gt;
  </code></pre>
  
  <p><br></p>
  
  <p>I'll be glad if someone can help me.</p>