import json | |
def convert_unicode_escapes(input_file, output_file): | |
# Read the JSON data from the input file | |
with open(input_file, 'r', encoding='utf-8') as f: | |
data = json.load(f) | |
# Write the JSON data to the output file with Unicode escapes decoded | |
with open(output_file, 'w', encoding='utf-8') as f: | |
json.dump(data, f, ensure_ascii=False, indent=4) | |
if __name__ == "__main__": | |
input_file = 'eval_before.json' | |
output_file = 'eval_before_readable.json' | |
convert_unicode_escapes(input_file, output_file) | |
print(f"Converted JSON saved to {output_file}") | |