SOURCE

var list =  [{ "id": 9401980, "baseSvtId": 9401980, "name": "危险野兽", "ruby": "-", "battleName": "-", "classId": 1001, "type": 6, "limitMax": 4, "friendshipId": 1000, "genderType": 3, "attri": 2, "sellQp": 2000, "sellMana": 5, "expType": 20, "combineMaterialId": 25, "cardIds": [ 3, 3, 3, 3, 3 ], "cost": 12, "battleSize": 2, "attackAttri": 1, "script": "{}", "illustratorId": 60, "collectionNo": 344, "materialStoryPriority": 1000 }, { "id": 9401990, "baseSvtId": 9401990, "name": "月夜魔女", "ruby": "-", "battleName": "-", "classId": 1001, "type": 6, "limitMax": 4, "friendshipId": 1000, "genderType": 3, "attri": 2, "sellQp": 1000, "sellMana": 3, "expType": 19, "combineMaterialId": 24, "cardIds": [ 3, 3, 3, 3, 3 ], "cost": 9, "battleSize": 2, "attackAttri": 1, "script": "{}", "illustratorId": 127, "collectionNo": 345, "materialStoryPriority": 1000 }, { "id": 9402000, "baseSvtId": 9402000, "name": "罗玛尼・阿其曼伯爵的款待", "ruby": "-", "battleName": "-", "classId": 1001, "type": 6, "limitMax": 4, "friendshipId": 1000, "genderType": 3, "attri": 2, "sellQp": 500, "sellMana": 1, "expType": 18, "combineMaterialId": 23, "cardIds": [ 3, 3, 3, 3, 3 ], "cost": 5, "battleSize": 2, "attackAttri": 1, "script": "{}", "illustratorId": 128, "collectionNo": 346, "materialStoryPriority": 1000 }];

var aaa = [];
list.forEach(function(v,k){
  
      console.log(v.id);
  var item = {"id":v.id,"name": v.name};
  aaa.push(item);});

var objBattle = {};

aaa.forEach(function (v, i) {
    objBattle[v.id] = v;
});
console.log(JSON.stringify(objBattle));

console 命令行工具 X clear

                    
>
console