from search import search import json results = search('loot box') with open('results.json', 'w') as file: file.write(json.dumps(results))