I'm searching for a way to read a specific value of multiple JSON arrays.
I was able to count them and now want to get a specific value from each of them but I wasn't able to find a way to set [0], [1], [2], etc. as a variable.
LineCount = len(obj['data']['monitors']);
print ("Active Lines:", LineCount)
LineNb = "obj['data']['monitors'][" + LineCount + "]['lines'][0]['name']"
LineName = json.dumps(LineNb)
print (LineCount, "Line", LineName)
while LineCount > 1:
LineCount -= 1
LineNb = "obj['data']['monitors'][" + LineCount + "]['lines'][0]['name']"
print (LineCount, "Line", LineName)
dumpsthem to a string. Or use a nonSQL database that works on Json structures.LineName = obj['data']['monitors'][LineCount]['lines'][0]['name']eval, which again begs the question - why?obj['data']['monitors'], then ... just do that. What is the difficulty?