ysdede commited on
Commit
1ac8a73
·
1 Parent(s): a8bc056

Add convert_unicode.py

Browse files
Files changed (1) hide show
  1. convert_unicode.py +16 -0
convert_unicode.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+
3
+ def convert_unicode_escapes(input_file, output_file):
4
+ # Read the JSON data from the input file
5
+ with open(input_file, 'r', encoding='utf-8') as f:
6
+ data = json.load(f)
7
+
8
+ # Write the JSON data to the output file with Unicode escapes decoded
9
+ with open(output_file, 'w', encoding='utf-8') as f:
10
+ json.dump(data, f, ensure_ascii=False, indent=4)
11
+
12
+ if __name__ == "__main__":
13
+ input_file = 'eval_before.json'
14
+ output_file = 'eval_before_readable.json'
15
+ convert_unicode_escapes(input_file, output_file)
16
+ print(f"Converted JSON saved to {output_file}")