How to return my data from a method (WebMethod) as a JSON Data from a web service i have tried with the
The class whose object i create ,
public class Questionnaire
{
public int QuestionnaireId { get; set; }
public string QuestionnaireName { get; set; }
}
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string GetUserQuestionnaire2()
{
return new Questionnaire
{
QuestionnaireId = 1234,
QuestionnaireName = string.Format("{0} {1}", "Microsoft", 1234)
};
}
[ScriptMethod(ResponseFormat=ResponseFormat.Json)]
but it does not return data in the above format but rather it returns in the XML format ????
Thanks . Regards