File size: 618 Bytes
720c349 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
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}")
|