how do you extract data from json using python
Solution 1:
Looks like a list comprehension would do the job. You access dictionary values by its keys, so since you want to access 'id'
s of dictionaries in a list under the 'isProcessOf'
key, which in turn is under the 'toRelationships'
key, you can do it as:
out = [d['id'] for d in dct['toRelationships']['isProcessOf']]
Output:
['proce123D00BB86', 'proc678DD0DBA4', 'proc978DD0DBA4']