Hi every one when returning json data from webservice top tag is adding please let me know how to remove top xml tag in the webservice
please let me know if any one this issue
i used the below method read
var obj = new List();
//MakesInfo objMakes = new MakesInfo();
MakesBL objMakesBL = new MakesBL();
if (Session["Makes"] == null)
{
obj = (List<MakesInfo>)objMakesBL.GetMakes();
Session["Makes"] = obj;
}
else
{
obj = (List<MakesInfo>)Session["Makes"];
}
StringBuilder str = new StringBuilder();
//var oSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();
//string sJSON = oSerializer.Serialize(obj);
//return sJSON;
//yourobject is your actula object (may be collection) you want to serialize to json
DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(List<MakesInfo>));
//create a memory stream
MemoryStream ms = new MemoryStream();
//serialize the object to memory stream
serializer.WriteObject(ms, obj);
//convert the serizlized object to string
string jsonString = Encoding.Default.GetString(ms.ToArray());
//close the memory stream
ms.Close();
return jsonString;
Use WCF just return list json object data is returned