i have a list of paths to json files.
files = ['/Users/sbm/Downloads/ds214mb/sub-EESS001/sub-EESS001_task-Cyberball_bold.json',
'/Users/sbm/Downloads/ds214mb/sub-EESS002/func/sub-EESS002_task-Cyberball_bold.json',
'/Users/sbm/Downloads/ds214mb/sub-EESS003/sub-EESS003_task-Cyberball_bold.json',
'/Users/sbm/Downloads/ds214mb/sub-EESS004/func/sub-EESS004_task-Cyberball_bold.json',
'/Users/sbm/Downloads/ds214mb/sub-EESS005/sub-EESS005_task-Cyberball_bold.json',
'/Users/sbm/Downloads/ds214mb/sub-EESS006/sub-EESS006_task-Cyberball_bold.json',
'/Users/sbm/Downloads/ds214mb/sub-EESS007/func/sub-EESS007_task-Cyberball_bold.json',
'/Users/sbm/Downloads/ds214mb/sub-EESS008/func/sub-EESS008_task-Cyberball_bold.json']
Now i intend to read all these files into dictionaries with same name as filename or diff name. And then iterate through those dict to find common key value pair.
I did the following to read all json files to diff dict. Now what would be an efficient way to compare all these dict to find common key: value pair?
import json
for file in range(0, len(files)):
globals()['json%s' % file] = "Hello"
i = 0
for file in files:
globals()['json%s' % i] = json.loads(open(file).read())
i = i+1
sample json file looks like:
{
'Manufacturer': 'Siemens',
'ManufacturerModelName': 'Magnetom Verio',
'RepetitionTime': 1.56,
'SliceTiming': [0.0,
0.78,
0.06,
0.84,
0.12],
'TaskName': 'Cyberball'}