score:2

Accepted answer

you are overwriting the name and data nodes of your newseries object each time you loop, by declaring them outside of the loop in that way.

i would turn this:

$.getjson('/uploads/test.json', function (list) {
    var newseries = {
        name: '',
        data: []
    };

    $.each(list, function (i, item) {
        newseries.name = item.name;
        newseries.data = item.data;
        options.series.push(newseries);
    });
    var chart = new highcharts.chart(options);

into something more like this:

$.getjson('/uploads/test.json', function (list) {
    var newseries;

    $.each(list, function (i, item) {
        newseries = {};
        newseries.name = item.name;
        newseries.data = item.data;
        options.series.push(newseries);
    });
    var chart = new highcharts.chart(options);

although really, in your case, you don't need to loop at all, because your return json is already in the proper format for highcharts.

you can try something like

$.getjson('/uploads/test.json', function (list) {
    options.series = list;
    var chart = new highcharts.chart(options);

instead (untested, might need to be tweaked).

score:2

please try this:

$.each(list, function (i, item) {
   if(item.name!=undefined){
       options.series.push({
          name:item.name,
          data:item.data
       });
   }
});

Related Query

More Query from same tag