import os import json files = ["gigaspeech_prompt_xs_large_v3_wer_0-20000.json", "gigaspeech_prompt_xs_large_v3_wer_20000-99999999.json"] output_file = "gigaspeech_prompt_xs_large_v3_wer.json" final_output = [] for file in files: with open(file) as f: data = json.load(f) final_output.extend(data) with open(output_file, "w") as f: json.dump(final_output, f)