I am developing an ASP.NET website in which based on certain logic, I am getting the output in a specific format on http://localhost/menu.aspx?callback=example
On the above URL, I get the output in a specific format foo({"1":"Jeff","2":"Mic","5":"Mark"}); using this small code.
outputText += Convert.ToString(k.GetValue(0));
for (Int32 i = 1; i < k.Length; i++)
{
outputText += "," + Convert.ToString(k.GetValue(i));
}
//
outputText += "}" +");";
Response.Write(outputText);
The full code of menu.aspx.cs is putup here. http://pastebin.com/dxbNmais
But this the output in html form on menu.aspx page. But my requirement is that the http answer must be json too. Please help in getting this JSON output. Not only that I I haven't tried JSON earlier but I am not too much a pro in ASP.NET.