NDJSON to CSV Converter
Convert NDJSON (Newline-Delimited JSON, also called JSONL) to CSV. Useful for BigQuery / Snowflake / Postgres exports that ship one JSON object per line. The header row is derived by scanning every row — no field is silently dropped because the first record didn’t have it. Nested values flatten to dotted-path columns; arrays serialize as JSON strings inside the cell.
How to use the NDJSON to CSV Converter
Paste your NDJSON (or paste from a .jsonl file). Every line is parsed as an independent JSON object. The converter does two passes: first to collect every key it sees (so the header is complete), then to emit each row with empty cells for missing keys. Nested objects flatten to dotted paths (user.address.city) when flattening is on; otherwise they’re JSON-stringified into a single cell.
Output is standard RFC 4180 CSV: fields with commas, quotes, or newlines are wrapped in double quotes; embedded quotes are doubled. Click Download .csv to save it directly, or copy and paste into your tool of choice.
About NDJSON to CSV Converter
NDJSON — one JSON document per line, no array wrapping — is the dominant format for streaming data and log shipping. BigQuery exports as NDJSON. Postgres’s COPY ... TO ... (FORMAT JSON) emits NDJSON. Most structured loggers (Pino, Bunyan, Winston JSON, Python structlog) write NDJSON. ML training pipelines consume NDJSON because you can append to the file without rewriting and stream-process line by line.
The catch is interop: most analyst-facing tools (Excel, Sheets, Tableau, even pandas’ read_csv) want CSV. Round-tripping by hand is tedious because the schema is implicit — different lines may have different keys, and nested structures don’t have an obvious CSV representation. This converter handles both: the union-of-keys header ensures nothing is dropped, and the flatten option turns nested objects into the kind of denormalised wide table CSV expects.
Common use cases
- BigQuery / Snowflake exports — sample data engineers can hand to analysts.
- Postgres COPY exports — dump as JSONL, convert to CSV for spreadsheet consumers.
- Log analysis — turn a day of structured logs into a CSV you can pivot in Excel.
- ML dataset inspection — convert a sample of your JSONL training data to CSV for a quick eyeball in a spreadsheet.
Frequently asked questions
What if rows have wildly different schemas?
How big a file can it handle?
jq -r '[.[]] | @csv' file.jsonl or write a streaming Python script.