Im working on consuming REST response from web service that returns JSON string. The result response from AJAX is that i get alot of info and I use JQuery.parseJSON(result) to get the value from each JSON Tag.
From this result response I need to format it so it can fit to Highchart. Highchart need it to be formatted to:
series: [{
name: 'Tokyo',
data: [7.0, 6.9, 9.5, 14.5, 18.2],
name: 'LA',
data: [7.0, 6.9, 9.5, 14.5, 18.2]
}]
What is the best way for me to loop through the result data and create JSON string like Highchart wants to have? Here below is a start of solving this but I cant finish.
success: function (result) {
var resultobj = jQuery.parseJSON(result);
for (i = 0; i < resultobj.length; i++) {
var objt = resultobj[i];
// what TODO?????
highchartresultarray.push(objt.name);
}
Any suggestions?