I have a method with ajax call to the server to get json result
var jsonData = $.ajax({
url: '/Reports/GetJsonData',
type: 'GET',
dataType: 'json',
error: function (err) {
alert("Error : "+err.statusText);
}
}).responseText;
Then I can get the Following Json result to the "jsonData" variable.
[
{"LineName":"L1","Car":23,"Bus":0,"Motorcycle":0,"Person":0,"Others":0}
,{"LineName":"L2","Car":0,"Bus":0,"Motorcycle":6,"Person":0,"Others":0}
,{"LineName":"L3","Car":10,"Bus":20,"Motorcycle":36,"Person":13,"Others":0}
]
I want to convert this result to the following format
[['LineName', 'Car', 'Bus','Motorcycle', 'Person','Others'],
['L1', 23, 0, 0,0,0],
['L2', 0, 0, 6,0,0],
['L3', 10, 20, 36,13,0]]
Then I want to use it in google visualization API for drawing a graph
var data = new google.visualization.arrayToDataTable(jsonData);
I just need to know if there any simple way to convertion the data which can pass to the google.visualization
see following working snippet...