This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: |