import json f1 = open('common.json', 'r') f2 = open('extended.json', 'r') data1 = json.load(f1) data2 = json.load(f2) f1.close() f2.close() words1 = [] words2 = [] for key in data1: words1.append(key) for key in data2: words2.append(key) dict = { 'common':words1, 'extended':words2 } f = open("dictionary.json", "w") json.dump(dict, f) f.close() print("done")