for(var i = 0; i < fruits.length; i++) { var obj = {}; // <---- Move declaration inside loop obj['data'] = fruits[i]; obj['label'] = label; arr.push(obj); }