Skip to content

Instantly share code, notes, and snippets.

# This will create a ndjson file
# input -> path to the json file
import json
filepath = input("enter complete path of the file ")
with open(filepath, "r") as read_file:
data = json.load(read_file)
new_file = f"{filepath.rsplit('.json')[0]}.ndjson"
result = [json.dumps(record) for record in data]
with open(new_file, 'w') as obj:
for i in result: