This Python script converts a CSV file located in this folder into an NDJSON file saved in the same folder.
NDJSON (Newline Delimited JSON) is a convenient format for streaming JSON objects, where each line is a valid JSON object.
It’s widely used in data pipelines and tools such as Google Cloud BigQuery, ElasticSearch, and many other data processing platforms.
-
Place your CSV file in this folder.
-
Make sure you have Python 3 installed.
-
Run the script from this folder with:
python csv_to_ndjson.py input.csv output.ndjson
If you have a CSV file like this:
name,age,city Alice,30,New York Bob,25,Los AngelesThe output NDJSON will be:
{"name":"Alice","age":"30","city":"New York"} {"name":"Bob","age":"25","city":"Los Angeles"}Feel free to modify or extend it as needed.