path = "['fields']['components']['name']"
json = {'fields': {'components': {'id': '10437', 'name': 'Bug'}}}
print(json[path])
Traceback (most recent call last):
File "<pyshell#17>", line 1, in <module>
print(json[path])
KeyError: "['fields']['components']['name']"
path = "fields.components.name".split('.')
json = {'fields': {'components': {'id': '10437', 'name': 'Bug'}}}
for p in path:
json = json[p]
print(json)
path = "['fields']['components']['name']"
json = {'fields': {'components': {'id': '10437', 'name': 'Bug'}}}
print (eval('json' + path + ''))