You can export a list of the group for each zone in the model using the file.all command as described in forum post here. e.g.
[file.all("test.txt","text") = zone.group(::zone.list)]
However, you might also need to consider the slots of your groups, and therefore might want an output file with more structure, which you can then manipulate? If so, something like the following might get you started in python:
import itasca as it
import json
it.command("python-reset-state false")
it.command("""
model restore "test"
""")
output_dict = {}
for z in it.zone.list():
slot_def = z.group()
slot_example_1 = z.group("Example 1")
slot_example_2 = z.group("Example 2")
output_dict[z.id()] = {
"slot = default" : slot_def,
"slot = 1" : slot_example_1,
"slot = 2" : slot_example_2
}
output_file = "test.json"
with open(output_file, 'w') as fout:
json.dump(output_dict, fout)