I have a JSON file that shows the hierarchy filesystem. For parsing JSON files I choose Jmespath to pars and get data. below JSON file could be nested. I want to select File name based on hierarchy.
{
"/home/user/Desktop/test_for_chain_click/test": [
{
"name": "file1",
"permission": "0664",
"type": "file"
},
{
"/home/user/Desktop/test_for_chain_click/test/directory1": [
{
"name": "file2",
"permission": "0664",
"type": "file"
},
{
"name": "file3",
"permission": "0664",
"type": "file"
}
],
"name": "directory1",
"type": "directory"
},
{
"/home/user/Desktop/test_for_chain_click/test/directory2": [
{
"name": "file4",
"permission": "0664",
"type": "file"
}
],
"name": "directory2",
"type": "directory"
}
],
"name": "test",
"type": "directory"
}
How Can I get file name with Jmespath on a file that could be nested?