Funny as it can sound, I transformed my datatable data into a string which looks something like this:
{ blocks: [
{"fromAge" : "60","fromAmount" : "0","toAge" : "64","toAmount" : "65000","color" : "red","orderNo" : "2"},
{"fromAge" : "66","fromAmount" : "0","toAge" : "72","toAmount" : "12000","color" : "red","orderNo" : "4"},
{"fromAge" : "64","fromAmount" : "0","toAge" : "72","toAmount" : "34400","color" : "red","orderNo" : "1"},
{"fromAge" : "64","fromAmount" : "19500","toAge" : "66","toAmount" : "50750","color" : "red","orderNo" : "3"}
]}
with the ideea that "blocks" is something like an array with 4 dicitionaries, then with this action I return the string to the View:
public ActionResult ChartDetails()
{
return Json(GetJson(datatable));
}
GetJson(DataTable dt) is the method which returns the string, and in view I get this:
"{ blocks: [{\"fromAge\" : \"60\",\"fromAmount\" : \"0\",\"toAge\" : \"64\",\"toAmount\" : \"65000\",\"color\" : \"Color [Orange]\",\"orderNo\" : \"2\"}, {\"fromAge\" : \"66\",\"fromAmount\" : \"0\",\"toAge\" : \"72\",\"toAmount\" : \"12000\",\"color\" : \"Color [Green]\",\"orderNo\" : \"4\"}, {\"fromAge\" : \"64\",\"fromAmount\" : \"0\",\"toAge\" : \"72\",\"toAmount\" : \"34400\",\"color\" : \"Color [Blue]\",\"orderNo\" : \"1\"}, {\"fromAge\" : \"64\",\"fromAmount\" : \"19500\",\"toAge\" : \"66\",\"toAmount\" : \"50750\",\"color\" : \"Color [Pink]\",\"orderNo\" : \"3\"}]}"
And because of all the \" and "}" and " I cannot read my Json with JQuery, is there some method to return a string with a normal encoding in my case?