1
0
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:
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: try:
for i in struct.split('.'): for i in struct.split('.'):
dataDict = dataDict[i] if i.isdigit():
dataDict = dataDict[int(i)]
else:
dataDict = dataDict[i]
return dataDict return dataDict
except KeyError: except:
print('Error: Invalid structure: ' + struct) print('Error: Invalid structure: ' + struct)
print(dataDict) print(dataDict)
raise raise