我有一个clubs
数组,如下所示:
[
{
"name": "Arsenal",
"codeName": "arsenal",
"nickName": "Gunners",
"dateFounded": "1886",
"stadium": "Emirates Stadium",
"manager": "Arsène Wenger",
"squad": []
},
{
"name": "Aston Villa",
"codeName": "aston-villa",
"nickName": "Villans",
"dateFounded": "1874",
"stadium": "Villa Park",
"manager": "Rémi Garde",
"squad": []
}
// and so on...
]
...我希望用相关数据填充每个空squad
数组。对于AFC伯恩茅斯,我想.push()
bournemouth
数组(见下文)squad
数组的clubs
属性:
[
{"firstName": "Artur",
"lastName": "Boruc",
"nationality": "pl",
"position": "gk",
"shirtNumber": "1",
"age": "36"},
{"firstName": "Adam",
"lastName": "Federici",
"nationality": "au",
"position": "gk",
"shirtNumber": "23",
"age": "31"},
// and so on...
]
首先,这可能吗?其次,这是解决这个问题的可行方法,还是有更有效/更好的方法来做到这一点?
在我开始编译所有数据之前,我想确定一下。
任何帮助/建议都会受到高度赞赏。