1
0
mirror of https://github.com/Adam-Ant/drone-trigger synced 2024-11-05 05:36:23 +00:00

Allow integer indexed arrays in JSON structure

This commit is contained in:
Joe Groocock 2017-10-31 21:02:16 +00:00
parent e28fed6933
commit dbebef95b8
Signed by untrusted user: frebib
GPG Key ID: E0B16BEACFBB6A86

View File

@ -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