File size: 399 Bytes
778d47d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | import json
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--jsonl-file', type=str, required=True)
args = parser.parse_args()
file = args.jsonl_file
data = []
with open(file, 'r') as f:
for line in f:
data.append(json.loads(line))
# export to json, replace jsonl to json
with open(file.replace('jsonl', 'json'), 'w') as f:
json.dump(data, f, indent=4)
|