File size: 459 Bytes
7c93e9d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
import json
def convert_jsonl_to_json(jsonl_file, json_file):
json_data = []
with open(jsonl_file, 'r',encoding="utf-8") as file:
for line in file:
json_data.append(json.loads(line))
with open(json_file, 'w',encoding="utf-8") as file:
json.dump(json_data, file)
# 使用示例
jsonl_file = 'TriviaQA/6test.jsonl'
json_file = 'TriviaQA/6test.json'
convert_jsonl_to_json(jsonl_file, json_file) |