Come ottenere la risposta JSON da un servizio Web 3.5 asmx

Ho il seguente metodo:

using System.Web.Services; using System.Web.Script.Services; using System.Web.Script.Serialization; using Newtonsoft.Json; using System.Collections; [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] //[System.ComponentModel.ToolboxItem(false)] [System.Web.Script.Services.ScriptService] // [System.Web.Script.Services.ScriptService] public class Tripadvisor : System.Web.Services.WebService { public Tripadvisor () { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public string HotelAvailability(string api) { JavaScriptSerializer js = new JavaScriptSerializer(); string json = js.Serialize(api); //JsonConvert.SerializeObject(api); return json ; } 

Qui imposto l’attributo ResponseFormat è json s viene ancora restituito come XML.

Voglio fare un json in formato usando questo servizio asmx. Qualche idea?