Hi folks,
i have the following data as a string in my Action method:
string json = "[[1,2],[3,4],[5,6]]";
Simple.
When I call the Json view, it encapsulates the result in two double quotes. This stops the client side javascript from loading this result into a javascript object.
eg.
return Json(json);
result => "[[1,2],[3,4],[5,6]]"
but, if i return the result as a ContentResult, then the result gets loaded into a javascript object and I can do whatever I need to do, with it.
eg.
return new ContentResult
{
Content = json,
ContentType = "application/json",
ContentEncoding =System.Text.Encoding.UTF8
};
result => [[1,2],[3,4],[5,6]]
(notice how the double quotes are missing?).
So, can someone explain what i should be doing right, please? I feel like the ContentResult is not the right way to do it.