title: Remove xml tag header from JSON response webService C#
body: <p>My problem is that I have a webservice on ASP.net, which returns a JSON string object (no XML). But when I call the webmethod I have this:</p>
  
  <pre><code>&lt;string xmlns="https://www.puzzlebooks.com.ar"&gt;
  {"Tipo":null,"Anio":0,"Mes":null,"CuentaContable":null,"Total":0,"OId":0}
  &lt;/string&gt;
  </code></pre>
  
  <p>On client side, the message error is this: <code>Unexpected token &lt; in json at position 0</code></p>
  
  <p>I expected this JSON:</p>
  
  <pre><code>{"Tipo":null,"Anio":0,"Mes":null,"CuentaContable":null,"Total": 0,"OId": 0}
  </code></pre>
  
  <p>a pure JSON</p>
  
  <p>This is my web service code:</p>
  
  <pre><code>[WebMethod(EnableSession = true)]
  [System.Web.Script.Services.ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Json) ]
  public string AcumuladoTotalCompraVenta_MesActual()
  {
      try
      {
          ModeloDeClases.Dominio.EstadisticaCompraVenta totalAcumulado = null;
          totalAcumulado = RepositorioServicios.RepositoryServices.getInstance().getEstadisticasServices().CompraVenta_TotalAcumuladoDelMesActual(23);
  
          if (totalAcumulado == null)
              totalAcumulado = new ModeloDeClases.Dominio.EstadisticaCompraVenta();
  
          string queHAY = new JavaScriptSerializer().Serialize(totalAcumulado);
          //  return totalAcumulado;   
          return queHAY;
      }
      catch (Exception ex)
      {
          this.Error(ex.Message);
          return null;
      }
  }
  </code></pre>
  
  <p>And the code from client side (aspx page), is this:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $(function () 
  {  
      $.ajax
      ({  
          type: "POST",  
          dataType: "json",  
          contentType: "application/json",  
          url: "../webServices/wsEstadisticas.asmx/AcumuladoTotalCompraVenta_MesActual",
          data: "{}",  
          success: chartAcumuladoComprasVentas_MesActual,  
  
          error: function (request, status, error) 
          {
              alert('NOP!');
              alert(request.statusText);
              alert(error);
              alert(request.toString());
          }
      });  
  })
  
  function chartAcumuladoComprasVentas_MesActual()
  {
      alert('IT S WORK!');
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>I search on this site about the same problems, but doesn't work. The library Newtonsoft for JSON don't work for me, because I get the same result when I didn't use it.</p>