Returning JSON in ASMX web service is quite simple using JavaScriptSerialization
Step1:
Simply tag your webmethod
[WebMethod]
[ScriptMethod(ResponseFormat=ResponseFormat.Json)]
Setp2:
and now using JavaScriptSerializer, serialize your object and simply return it.
new
Step1:
Simply tag your webmethod
[WebMethod]
[ScriptMethod(ResponseFormat=ResponseFormat.Json)]
Setp2:
and now using JavaScriptSerializer, serialize your object and simply return it.
new
System.Web.Script.Serialization.JavaScriptSerializer().Serialize(company);
for more information around click JavaScriptSerializer
No comments:
Post a Comment