var arr = [{
"id": "1231",
"name": "中箱"
}, {
"id": "9387",
"name": "小箱"
}, {
"id": "68433",
"name": "中箱"
}, {
"id": "1231",
"name": "小箱"
}, {
"id": "43566",
"name": "冷柜"
}];
var result = {};
for (var i = 0; i < arr.length; i++) {
var ai = arr[i], ain = ai.name;
if (!result[ain]) {
result[ain] = [ai];
} else {
result[ain].push(ai);
}
}
console.log(result);