Answer the question
In order to leave comments, you need to log in
How to bypass a dictionary with an array inside?
Question in the subject, in principle. The strange structure of statham. There is a dictionary in the dictionary, and in it an array with dictionaries, the roof goes.
{
"folder": [
{
"file": [
{
"path": "fae3c54eb95cdd24aafb3837f25530cd/asset",
"mime-type": "application/octet-stream",
"size": 4892,
"name": "asset"
},
{
"path": "fae3c54eb95cdd24aafb3837f25530cd/preview.png",
"mime-type": "image/png",
"viewable": 1,
"size": 5733,
"name": "preview.png"
}
],
"name": "fae3c54eb95cdd24aafb3837f25530cd",
"path": "undefined"
},
{
"file": [
{
"path": "fdfa6ff90c30bb94f8500ed681f582cf/asset",
"mime-type": "application/octet-stream",
"size": 4912,
"name": "asset"
},
{
"path": "fdfa6ff90c30bb94f8500ed681f582cf/preview.png",
"mime-type": "image/png",
"viewable": 1,
"size": 20010,
"name": "preview.png"
}
],
"name": "fdfa6ff90c30bb94f8500ed681f582cf",
"path": "undefined"
}
],
"file": [
{
"path": ".icon.png",
"mime-type": "image/png",
"viewable": 1,
"size": 26899,
"name": ".icon.png"
}
]
}
Answer the question
In order to leave comments, you need to log in
My attempt to deduce keys recursively
def Recurse(arraydict):
# массив словарей
for i in arraydict:
for key_dict in i.keys():
print(key_dict)
if type(i[key_dict]) == list:
Recurse(i[key_dict])
data = 'json, который выложил выше'
Recurse([data])
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question