mirror of
https://github.com/Adam-Ant/drone-trigger
synced 2024-12-20 07:24:34 +00:00
Allow integer indexed arrays in JSON structure
This commit is contained in:
parent
e28fed6933
commit
dbebef95b8
7
main.py
7
main.py
@ -79,9 +79,12 @@ def jsonVal(url, struct):
|
||||
|
||||
try:
|
||||
for i in struct.split('.'):
|
||||
dataDict = dataDict[i]
|
||||
if i.isdigit():
|
||||
dataDict = dataDict[int(i)]
|
||||
else:
|
||||
dataDict = dataDict[i]
|
||||
return dataDict
|
||||
except KeyError:
|
||||
except:
|
||||
print('Error: Invalid structure: ' + struct)
|
||||
print(dataDict)
|
||||
raise
|
||||
|
Loading…
Reference in New Issue
Block a user