I have the following code:
private ActionResult Foo(string format, IEnumerable<String> myResults)
{
if (format == "JSON")
{
return ConvertToAnJsonActionResult(myResults); // GetJsonResults(sm);
}
else //turn to html and return
{
return View("Index", myResults);
}
}
myResults is a collection of JSON strings. I need to convert it to a ActionResult that holds that JSON array and send it to the client. How do I do that?
I tried return Json(myResults) which returns a JsonResult but then i am JSON encoding a collection of JSON objects which will result in a \ added to every ” when the client gets the results.
I ended up overriding JsonResult: