import json # Load the original file with open('/l/users/salma.hassan/TrialGPT_scratch/dataset/sigir/id2queries.json', 'r') as f: data = json.load(f) # Wrap each entry with 'gpt-35-turbo' wrapped = {} for k, v in data.items(): wrapped[k] = {"gpt-35-turbo": v} # Write to a new file (to avoid overwriting the original) with open('/l/users/salma.hassan/TrialGPT_scratch/dataset/sigir/id2queries_gpt35turbo.json', 'w') as f: json.dump(wrapped, f, indent=2) print('Done. Output written to id2queries_gpt35turbo.json')