I am creating a webservice in asp.net. Below is the response I’m getting.
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/">{"Question1":"do the like the idea of the first speaker?","Option1":"YES","Option2":"NO","Option3":"NOT SURE","Option4":"","Option5":"","Type":"button","QID":"q1"}</string>
How can I remove the xml tag from here…any ideas?
[WebMethod(EnableSession = true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string GetQuestions()
{
return new JavaScriptSerializer().Serialize(Biz.BAL.GetQuestions());
}
Could you verify you web.config if the following is correct:
1) “Rerouting the *.ASMX httphandler to ScriptHandlerFactory”
2) “Json serialization”
You can add the jsonSerialisation setting to your web.config to make sure the Json serialization works: