From dbebef95b8bd621a60e24a236d8f90df68bf354a Mon Sep 17 00:00:00 2001 From: Joe Groocock Date: Tue, 31 Oct 2017 21:02:16 +0000 Subject: [PATCH] Allow integer indexed arrays in JSON structure --- main.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 72a83cb..401753a 100644 --- a/main.py +++ b/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