AsyncHttpResponseHandler
how to return JSON object in c# web service
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jaganathan BantheswaranPosted Mar 24, 2014, 3:00 AM
Your web service method should be something like this,
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]//Specify return format.
public YourObjectType TestService()
{
YourObjectType response = new YourObject();
try
{
//Stuff goes here
}
catch (Exception ex) { responseText = "Opps wehave an error! Exception message:" + ex.Message; }
return response;
}