Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
var data = [{  
  "name":"name1",
  "custitem_color":"3",
  "custitem_ribbon":"1",
  "baseprice":"10.00",
  "cost":"12.00"
},
 {  
   "name":"name2",
   "custitem_color":"4",
   "custitem_ribbon":"2",
   "baseprice":"20.00",
   "cost":"15.00"
 },
 {  
   "name":"name3",
   "custitem_color":"6",
   "custitem_ribbon":"3",
   "baseprice":"30.00",
   "cost":"22.00"
 },
 {  
   "name":"name4",
   "custitem_color":"8",
   "custitem_ribbon":"4",
   "baseprice":"40.00",
   "cost":"18.00"
}];
var result = {},
    len    = data.length, i, prop;
for (i = 0; i < len; i++) {
  for (prop in data[i]) {
    if (!result[prop]) {
      result[prop] = [];
    }
    result[prop].push(data[i][prop]);
  }
}
console.log(result);
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
_alexander_pro
0viewers