我有两个类似这样的 json 响应,基本上需要从 res2 中提取“状态”并根据匹配的uid插入到 res1 中
res1 = [
{
uid: 'RBZ7K2122715',
Model: Mod1,
lastReceived: date1
},
{
uid: 'RBZ7K2123333',
Model: Mod2,
lastReceived: date2
}
]
res2 = [
{
uid: 'RBZ7K2122715',
Status: [ [Object1], [Object2], [Object3] ]
},
{
vin: 'RBZ7K2123333',
Status: [ [Object4], [Object5] ]
}
]
我想得到这样的回应:
result = [
{
uid: 'RBZ7K2122715',
Model: Mod1,
lastReceived: date1,
Status: [ [Object1], [Object2], [Object3] ]
},
{
uid: 'RBZ7K2123333',
Model: Mod2,
lastReceived: date2,
Status: [[Object4], [Object5]]
}
]
如果任何特定的 uid 不存在于 res1 中但存在于 res2 中,则在 res1 字段中填充“N/A”,反之亦然
30秒到达战场
冉冉说
相关分类