我有一个包含项目名称和项目所有者的对象列表,如下所示:
[
{
project_name:"abc",
project_duration:"2 weeks",
contactInfo: [
{
name:"john"
},
{
name:"ron"
},
]
},
{
project_name:"def",
project_duration:"4 weeks",
contactInfo: [{
name:"steve"
}]
},
{
project_name:"xyz",
project_duration:"9 weeks",
contactInfo: [{
name:"john"
}]
}
]
如何从上面的列表中为每个用户创建一个包含项目的列表?
[
{
name: "john",
projects:[
{
project_name:"abc"
},
{
project_name:"xyz"
}
]
}
]