Ask a question of json multi-level Filter

A 2-tier json, is used in the project. Now there is a search function. Searching Filter according to the username field in the second-tier json is a search function. If there is matching data in the second layer, it will show the first layer and the second layer data. If there is no matching data in the second layer, it will not be shown in the first layer. I want to use 2-tier filter to directly Filter out, but some can not turn around, ask for advice
the following is a screenshot of the data structure and code

clipboard.png

{"64":{"groupid":64,"groupname":"","online":0,"open":false,"select":false,"list":{"64-64":{"username":"","id":"64-64","avatar":"/static/img/avatar/no_avatar.png","sign":"wxid_n7fayv381dxh22","online":1,"status":"","unread":0,"fromuid":"64","fromuname":"","select":false},"64-62":{"username":"NcHPmzHfGY","id":"64-62","avatar":"/static/img/avatar/no_avatar.png","sign":"wxid_8wink999rszm22","online":1,"status":"","unread":0,"fromuid":"64","fromuname":"","select":false},"64-60":{"username":"","id":"64-60","avatar":"http://wx.qlogo.cn/mmhead/cypR72jV8BHjDwNh3Nc1YcsgzmiaZacpR1dgiaibt4QuMs/0","sign":"weixin","online":1,"status":"","unread":0,"fromuid":"64","fromuname":"","select":false},"64-57":{"username":"bot yang","id":"64-57","avatar":"http://wx.qlogo.cn/mmhead/LIMVN2XWG8GkwyicDMpc44eKPl9kaUiawJyaq1Qe1Iaiby76cSqhDSnyw/0","sign":"wxid_nc629a7n1dvp22","online":1,"status":"","unread":0,"fromuid":"64","fromuname":"","select":false},"64-288":{"username":"","id":"64-288","avatar":"http://wx.qlogo.cn/mmhead/ver_1/OG86Z9E5KU5SBrIvSNJjibQZhn1VK9kbbhBhpsvhME0w9ibusib90PanicHFLYP5JQnia2JgDYOkKfaMUTBV3cWmqgw/0","sign":"yangshuhai","online":1,"status":"","unread":0,"fromuid":"64","fromuname":"","select":false}}},"65":{"groupid":65,"groupname":"Ava","online":0,"open":false,"select":false,"list":{"65-65":{"username":"Ava","id":"65-65","avatar":"http://127.0.0.1:8184/api/log/file?filekey=e7bae8eecefbcde6169d2dbe55affbb2","sign":"wxid_cdznyt4gqzro22","online":1,"status":"","unread":0,"fromuid":"65","fromuname":"Ava","select":false},"65-66":{"username":"-","id":"65-66","avatar":"http://wx.qlogo.cn/mmhead/ver_1/udIfAQibTnGiceL3O7q1lIdf9vUobKSdjRIPg6qOiaoO1DgiaOAbYz104skSciaL9tmJB1UGqZzfaQc6IYw1JE5uROKpxxUSRibibPtZayCrmCjakI/0","sign":"wxid_5jo6u4jqrc0q22","online":1,"status":"","unread":0,"fromuid":"65","fromuname":"Ava","select":false},"65-62":{"username":"NcHPmzHfGY","id":"65-62","avatar":"/static/img/avatar/no_avatar.png","sign":"wxid_8wink999rszm22","online":1,"status":"","unread":0,"fromuid":"65","fromuname":"Ava","select":false},"65-60":{"username":"","id":"65-60","avatar":"http://wx.qlogo.cn/mmhead/cypR72jV8BHjDwNh3Nc1YcsgzmiaZacpR1dgiaibt4QuMs/0","sign":"weixin","online":1,"status":"","unread":0,"fromuid":"65","fromuname":"Ava","select":false},"65-57":{"username":"bot yang","id":"65-57","avatar":"http://wx.qlogo.cn/mmhead/LIMVN2XWG8GkwyicDMpc44eKPl9kaUiawJyaq1Qe1Iaiby76cSqhDSnyw/0","sign":"wxid_nc629a7n1dvp22","online":1,"status":"","unread":0,"fromuid":"65","fromuname":"Ava","select":false},"65-288":{"username":"","id":"65-288","avatar":"http://wx.qlogo.cn/mmhead/ver_1/OG86Z9E5KU5SBrIvSNJjibQZhn1VK9kbbhBhpsvhME0w9ibusib90PanicHFLYP5JQnia2JgDYOkKfaMUTBV3cWmqgw/0","sign":"yangshuhai","online":1,"status":"","unread":0,"fromuid":"65","fromuname":"Ava","select":false},"65-289":{"username":"Massage","id":"65-289","avatar":"/static/img/avatar/no_avatar.png","sign":"12312124396@chatroom","online":1,"status":"","unread":0,"fromuid":"65","fromuname":"Ava","select":false}}}}
Nov.09,2021

data is your data, keyword is the search keyword

  

take a closer look. Json is an object, so you can't use filter,. Can you only use for to loop?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e938fe-146d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e938fe-146d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?