json = {'data':{'variables':{'startupProcessInfo':{'iin': 'first'}}, 'piid': 'second', 'executionState': 'third', 'creationTime': 'fourth'}}
path_arr = ["['data']['variables']['startupProcessInfo']['iin']",
"['data']['piid']",
"['data']['executionState']",
"['data']['creationTime']"]
for x in path_arr:
json_iter = json
path = x[2:-2].split("']['")
for p in path:
json_iter = json_iter[p]
print(json_iter)
Вывод:
========================== RESTART: E:/Python/1.py ==========================
first
second
third
fourth
Как пример. изменить можешь на свой код. вот
тут я спрашивал как строку передать как путь.