2 回答
TA贡献1780条经验 获得超1个赞
挂起的密钥会以这种方式丢失
set = {
pending: set.pending.filter(({ po_id }) => { return po_id === 'm86lu'; })
}
TA贡献2003条经验 获得超2个赞
循环遍历json,根据评论的建议一一添加到新集合中。
var input = {
"pending": [
{
"is_active": true,
"order_updated": false,
"po_id": "m86lu",
}, {
"is_active": true,
"order_updated": false,
"po_id": "m86lu",
}, {
"is_active": true,
"order_updated": false,
"po_id": "m86l89u",
}]}
var output = {};
for (var key in input) {
if (!input.hasOwnProperty(key)) {
continue;
}
let content = input[key].filter(({ po_id }) => { return po_id === 'm86lu'; });
output[key] = content;
}
console.log(output);
添加回答
举报
