Blog
JSONJSONLCSV

JSONL / NDJSON Explained: From AI APIs and Logs to CSV

September 4, 2026 ·

Open an AI API log, a Hugging Face dataset, or a production event stream and you will not find one big JSON array - you will find JSONL (JSON Lines, also called NDJSON): one complete JSON object per line. It streams, appends, and parallelizes beautifully, which is why 2025–2026 data infrastructure - from log pipelines to LLM training sets - standardized on it.

Spreadsheets hate it, though. Excel cannot open JSONL, and nested objects inside each line do not map to columns. This post shows the format, the two conversions that matter, and how to do both privately in your browser with RividTech.

JSON vs JSONL in 30 seconds

// users.json - one array, must parse whole file
[
  {"id": 1, "email": "a@example.com", "tags": ["pro", "eu"]},
  {"id": 2, "email": "b@example.com", "tags": ["free"]}
]

// events.jsonl - one object per line, streamable
{"id": 1, "email": "a@example.com", "tags": ["pro", "eu"]}
{"id": 2, "email": "b@example.com", "tags": ["free"]}
  • JSON array - great for small API responses; breaks on huge files and trailing commas.

  • JSONL / NDJSON - great for logs, streams, datasets; read line-by-line, skip bad lines without losing the file.

  • Validate each JSONL line before converting; see jq for JSON Processing from the Terminal for command-line checks.

Step 1: preview and validate the lines

Paste a JSON array into JSON Preview to see the table shape. For JSONL, validate each line to catch a pretty-printed object spanning multiple lines, a trailing comma, or one corrupt line in 100k. See jq for JSON Processing from the Terminal for shell-based checks.

Step 2: flatten nested objects and arrays

Real JSONL nests: user.address.city, order.items[], metadata.model. Spreadsheets need flat columns, so expand with Flatten JSON :

{"id": 7, "user": {"email": "c@example.com", "plan": "pro"}, "tags": ["eu", "beta"]}
-- flatten -->
id | user.email      | user.plan | tags.0 | tags.1
7  | c@example.com   | pro       | eu     | beta

Deep background with API examples: Flatten Nested JSON for Spreadsheets and CSV . In pandas, the same step is pd.read_json("events.jsonl", lines=True) plus pd.json_normalize - see How to Use Pandas for CSV and JSON Data Processing .

Step 3: convert JSONL to CSV, Excel, or SQL

  • JSON to CSV - flattened records to a spreadsheet-ready table.

  • JSON to Excel - straight to .xlsx for non-technical stakeholders.

  • JSON to SQL - CREATE TABLE + INSERT for Postgres, MySQL, SQLite.

  • JSON to TSV - when values contain commas that fight CSV.

Reverse direction when an API wants JSON back: CSV to JSON (safely - see How to Convert CSV to JSON Safely ).

Step 4: clean the flattened table

Flattening exposes mess: inconsistent keys across lines, null vs missing vs empty string, mixed date formats. Run the standard pass:

Large JSONL: sample, split, stream

Take a small JSONL export from the source to design the flatten mapping, validate the mapping on that sample, then apply it to the full export in chunks. If the flattened CSV is too big for Excel, see Excel Won't Open My Large CSV.

Getting started

Preview, flatten, convert, and inspect: JSON Preview, Flatten JSON, JSON to CSV, and CSV Preview. Everything runs on your device - see our Privacy Policy.

Written by

The RividTech Experts Team builds and maintains RividTech's data tools and writes its guides. Every guide is checked against the tools' actual behavior and updated when that behavior changes.

Spotted an error? Email info@rividtech.online.