[{id: 1, name: 'Vasya'}, {id: 'anyString', name: {}}]
[{1: 'Vasya'}, {anyString: {}}]
const oldData = [{id: 1, name: 'Vasya'}, {id: 'anyString', name: {}}];
const newData = oldData.map(function(item) {
const newItem = {};
newItem[item.id] = item.name;
return newItem;
});
var a = [{id: 1, name: 'Vasya'}, {id: 'anyString', name: {}}]
var b = a.map(obj => {
let newObj = {}
newObj[obj.id] = obj.name
return newObj
})