我有一个JSON对象,该对象反映了工作人员的日程安排,并且城市名称嵌套在底层。如何创建搜索(过滤器)以返回整个对象,但仅返回城市匹配的位置?请参阅此密码笔https://codepen.io/jakeburkart/pen/LgdVRN。是否使用计算或方法?我在哪里循环? 这是JSON的一小部分:
{
"jyoung": {
"timeslot-0": [],
"timeslot-1": [{
"userName": "jyoung",
"customerName": "BLOCK",
"customerAddress": "BLOCK",
"customerCity": "Vacaville",
"customerZip": "95687",
"customerPhone": "block "
}],
"timeslot-2": [],
"timeslot-3": [{
"userName": "jyoung",
"customerName": "BLOCK",
"customerAddress": "BLOCK",
"customerCity": "Dublin",
"customerZip": "95687",
"customerPhone": "N/A"
}],
"timeslot-4": []
}
}