Tools

Developer guide

CSV vs TSV vs JSON vs JSONL: The Only Comparison Table You Need

Four text formats carry the vast majority of data exchanged between systems. They overlap more than most people think, and the choice usually comes down to two questions: is your data flat or nested, and does it stream? This guide answers both with one table and a decision rule you can apply in seconds.

Benjamin Rotshtein

Written by Benjamin Rotshtein

Updated

Flat data for spreadsheets?
CSV or TSV. Both are tiny and universally supported. Pick TSV when your values are full of commas; otherwise CSV wins on compatibility.
Nested or typed data for code?
JSON. It carries types and nesting natively and is the web's default. Reach for JSONL when records stream, append, or grow into the gigabytes.
What if I need to convert?
All four convert to each other cleanly for flat data. Our converters handle every pair in your browser, including flattening JSON nesting into rows.

The four formats at a glance

CriterionCSVTSVJSONJSONL
DelimiterCommaTabNone (syntax)Newline per record
File size (flat)SmallestSmallestLargestLarger than CSV
Data typesAll textAll textExplicitExplicit per line
NestingNoNoYesYes
StreamingLine by line, flatLine by line, flatWhole doc bufferedLine by line, nested
Append / reuseAppend a rowAppend a rowRewrite whole fileAppend a line
Quoting trapCommas need quotesTabs cannot appearNone (strict syntax)None (strict syntax)
Tooling sweet spotExcel, BI, DB importsUnix, DB importersAPIs, JS, NoSQLLogs, ML, pipelines

How to decide in 10 seconds

Ask two questions in order:

When flat, choose between CSV and TSV by checking whether your values contain commas. When nested, choose between JSON and JSONL by checking whether you need streaming.

Flat formats: CSV vs TSV

Both write one record per line with a header. CSV splits fields on commas and must quote any value that contains a comma, quote, or newline. TSV splits on tabs, so commas are ordinary characters — but a literal tab inside a value is the one thing it cannot represent. Pick CSV for universal compatibility; pick TSV when your data is comma-heavy or you generate files in code and want to avoid quoting bugs entirely.

Nested formats: JSON vs JSONL

JSON is a single document — one object or array — with explicit types and arbitrary nesting. It is the native format of the web and the default for API payloads. JSONL is the same objects, one per line, with no enclosing array. The trade-off: JSONL repeats keys on every line (larger files) but streams, appends, and tolerates a corrupt line — which is why logs, event pipelines and ML datasets use it.

Size reality check: 200,000 rows

Measured on a realistic 200,000-row, 12-column export for this site, the same flat data weighs:

CSV~20.5 MB
TSV~20.5 MB (similar)
JSONL~49 MB — 2.4× CSV
JSON~49 MB (same as JSONL)

The takeaway: for flat data the JSON family pays a ~2.4× size premium that it only earns back with nesting or streaming. There is no free lunch — match the format to the job.

Converting between all four

Every conversion is either flatten (JSON/JSONL → CSV/TSV) or re-nest (CSV/TSV → JSON/JSONL). All converters on this site run entirely in your browser:

Frequently asked questions

Which of the four formats is the smallest?

For the same flat table, TSV and CSV are both the smallest — headers are written once and values are raw text. JSON and JSONL are typically 1.5-3x larger because key names repeat on every record. JSONL can beat CSV for very narrow records, but in general: CSV ≈ TSV < JSONL < JSON.

Which formats handle nested data?

Only JSON and JSONL. CSV and TSV are flat by design — nesting requires fragile flattening (user.address.city) or JSON text inside a cell. If your records contain nested objects, arrays or heterogeneous shapes, pick JSON or JSONL.

Can JSONL be streamed and appended?

Yes, and that's its main advantage. Each line is an independent JSON object, so you can read line by line with flat memory, append without rewriting the file, and skip a corrupt line without losing the rest. Plain JSON must be buffered and parsed as one unit.

When should I use TSV instead of CSV?

When your values contain commas — addresses, descriptions, lists — because in TSV a comma is just a character and needs no quoting. The one character TSV cannot represent is a tab. If neither applies, CSV's universal compatibility usually wins.

Which format is best for ML training datasets?

JSONL, overwhelmingly. Frameworks like HuggingFace Datasets and Spark load newline-delimited JSON directly, keep types, and stream huge files. CSV works for flat tabular sets but loses types and nesting; JSON is too rigid to stream at scale.

How do I convert between all four formats?

Everything ultimately flattens to rows and columns or unflattens back to objects. Our converters cover CSV ⇄ JSON, CSV ⇄ TSV, JSON ⇄ TSV and JSON Lines, all in your browser — paste once and download the result.

Related guides