My json file look likes this and I\'m trying to access the element syslog
in a for loop.
{
\"cleanup\":{
\"folderpath\":\"/home/FBML7HR/lo
You are looping over the values in the list referenced by data['execution']
, not indices.
Just use those values (dictionaries) directly:
for i in data['execution']:
cmd = i['test_case']['scriptname']
You probably want to give that a more meaningful loop name:
for entry in data['execution']:
cmd = entry['test_case']['scriptname']