我有 2 个这样的 json 输入:
[
{
userId: 32159,
userFirstName: "john",
userLastName: "doe",
plans: [ ]
},
{
userId: 32157,
userFirstName: "dave",
userLastName: "mess",
plans: [ ]
}
]
和
[
{
userId: 32159,
userFirstName: "john",
userLastName: "doe",
results: [ ]
},
{
userId: 32157,
userFirstName: "dave",
userLastName: "mess",
results: [ ]
}
]
我希望输出为:
[
{
userId: 32159,
userFirstName: "john",
userLastName: "doe",
plans: [ ],
results: [ ]
},
{
userId: 32157,
userFirstName: "dave",
userLastName: "mess",
plans: [ ],
results: [ ]
}
]
如何在 javascript 中做到这一点。请帮助。这里 userId 是一个唯一字段