Save .mrk.json files from .mrb without opening each .mrb

Is there a way to save all mrk.json files in a .mrb bundle without opening each .mrb individually and selecting the .mrk.json files individually in the save window?

Context:
For each subject I have a .mrb file that contains the relevant .mrk.json files. I use Spyder (https://www.spyder-ide.org/) for data analysis of the contents of the .mrk.json files.

Currently, I open each .mrb file and select the .mrk.json files manually (about 20 files per subject) in the save window and save them into a folder. Is there a way to do this without needing to open each .mrb file individually? The project is quickly expanding and I would like to automate this step.

The .mrb file is just a .zip, so you can open it and extract the .mrk.json files pretty easily with a python script.

Thank you for the quick response. I got it working.

Here is my approach in case others have the same question:

using zipfile
using json

archive = zipfile.ZipFile(directory+mrb_name, 'r')
filenames = [x for x in archive.namelist() if '.mrk.json' in x]
f = archive.open(filenames[i])
data = json.load(f)
1 Like