Click here to Skip to main content
15,886,864 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Result = Object {d: "[{"SID":"U064971","HEADCOUNT":"823","MANAGERCOUNT"…T":"16.16","CCYESCOUNT":"111","CCNOCOUNT":"712"}]"}

The above is my JSON.

The output i want to bind in highcharts pie chart in series data as below:

The output data i want as below
[
        ['HEADCOUNT', 823],
        ['CCNOCOUNT', 712],
        ['CCYESCOUNT', 111],

     ]


What I have tried:

success: function (Result)
               {
                   var data = [];

                   Result = jQuery.parseJSON(Result.d);

                   var keys = Object.keys(Result);

                   for (var i = 0; i < keys.length; i++) {
                       var val = Result[keys[i]];

                       for (var i in val)
                       {
                           var series = new Array(Object[0], Object[4]);

                           data.push(parseFloat(series));
                       }
                   }
Posted
Comments
jaket-cp 22-Feb-17 5:22am    
I created a quick fiddle:
https://jsfiddle.net/skobzLs7/
maybe it can help you
Member 12359516 23-Feb-17 4:08am    
Thanks alot it worked.
jaket-cp 23-Feb-17 4:13am    
glad to help

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900