title: ASP.NET - Can a web method's response be SOAP (XML) and JSON?
body: <p>I have an ASP.NET web application.</p>
  
  <p>It has a web service, with several web methods.</p>
  
  <p>All of these web methods are based on the default settings. For instance:</p>
  
  <pre><code>using System.Web.Services;
  
  namespace WebApplication2
  {
      [WebService(Namespace = "http://mydomain.org/")]
      [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
      [System.ComponentModel.ToolboxItem(false)]
      public class WebService1 : WebService
      {
          [WebMethod]
          public string HelloWorld()
          {
              return "Hello World";
          }
  
          [WebMethod]
          public Person GetPersonById(int id)
          {
              Person result = new Person();
              // code...
              return person;
          }
      }
  }
  </code></pre>
  
  <p>The response is in SOAP (XML) format.</p>
  
  <p>My question: Can I change the response's format to JSON, based on an input parameter or on a header?</p>