我有一个非常复杂的JSON数据,其中包含许多子节点/子节点。我正在竭尽全力使其扁平化,因此我实现了自己的目标。我只需要带走所有嵌套的“子级”和子级子级,然后将它们推入单个数组中即可。请帮帮我,下面是我的示例数据,{ "path": "/root", "name": "Through_5cd5553eb7f004432205cb6b", "type": "folder", "children": [ { "path": "/root/Through_5cd5553eb7f004432205cb6b/assets", "name": "assets", "type": "folder", "children": [ { "path": "/root/Through_5cd5553eb7f004432205cb6b/assets/proxies.png", "name": "proxies.png", "type": "file" }, { "path": "/root/Through_5cd5553eb7f004432205cb6b/assets/targets.png", "name": "targets.png", "type": "file" } ] }, { "path": "/root/Through_5cd5553eb7f004432205cb6b/codgen-for-wsil-backend-esg", "name": "codgen-for-wsil-backend-esg", "type": "folder", "children": [ { "path": "/root/Through_5cd5553eb7f004432205cb6b/codgen-for-wsil-backend-esg/assets", "name": "assets", "type": "folder", "children": [ ] }, { "path": "/root/Through_5cd5553eb7f004432205cb6b/codgen-for-wsil-backend-esg/index.md", "name": "index.md", "type": "file" } ] }, { "path": "/root/Through_5cd5553eb7f004432205cb6b/index.md", "name": "index.md", "type": "file" }, { "path": "/root/Through_5cd5553eb7f004432205cb6b/jwt-implementation-esg", "name": "jwt-implementation-esg", "type": "folder", "children": [ { "path": "/root/Through_5cd5553eb7f004432205cb6b/jwt-implementation-esg/assets", "name": "assets", "type": "folder", "children": [ ] }, { "path": "/root/Through_5cd5553eb7f004432205cb6b/jwt-implementation-esg/index.md", "name": "index.md", "type": "file" } ] } ]}
添加回答
举报
0/150
提交
取消