import json def convert_jsonl_to_json(jsonl_file, json_file): json_data = [] with open(jsonl_file, 'r') as file: for line in file: json_data.append(json.loads(line)) with open(json_file, 'w') as file: json.dump(json_data, file) # 使用示例 jsonl_file = 'Xtuner_Read_Comperhension50k.jsonl' json_file = 'Xtuner_Read_Comperhension50k.json' convert_jsonl_to_json(jsonl_file, json_file)