File size: 387 Bytes
778d47d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | import json
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--json-file', type=str, required=True)
args = parser.parse_args()
file = args.json_file
# Read the JSON file
with open(file, 'r') as f:
data = json.load(f)
# Export to JSONL
with open(file.replace('.json', '.jsonl'), 'w') as f:
for record in data:
f.write(json.dumps(record) + '\n')
|