JSON to TSV Converter
Tab-separated is what you want when the data is full of commas. Nested fields flatten into dotted columns and a value with a comma in it comes through unquoted, because a comma means nothing to a tab-separated file.
To convert JSON to TSV, paste your array of objects above. Keys become the header row, each object becomes a tab-separated line, and nested objects flatten into dotted columns. Quoting is decided against the tab, so a value containing a comma is written plainly; only a value containing a tab, a newline or a quote needs protecting.
Want to pick the columns first? Open the app
Why tabs instead of commas
Two reasons, and both are practical. The first is that a tab is far rarer inside real data than a comma is. Addresses, product descriptions, note fields and anything written by a person are full of commas, and every one of them forces a quoted field in a CSV. A tab-separated file of the same data is usually quote-free and much easier to read in a terminal.
The second is the clipboard. Tab-separated text is what spreadsheets accept when you paste, which means a TSV pasted straight into Excel, Numbers or Google Sheets fills the grid without an import dialogue. A CSV pasted the same way lands in one column.
The over-quoting bug this avoids
Quoting exists to protect the separator. In a comma-separated file a value containing a comma must be quoted; in a tab-separated file it must not, because the comma is just a character.
An audit of the leading free converter on this term found it quoting anyway. Asked for tab output, it still wrapped values in quotes because they contained commas, producing lines like this:
total note
"2151,83" "Osaka, Japan"
Those quotes are now part of the values as far as any reader is concerned. Here the quoting is decided against the separator actually being written, so the same data comes out clean and the only things that get quoted are values containing a tab, a newline or a quote character.
Worked example
A response with a comma inside a value:
[
{ "order_id": "ORD-00001", "customer": { "name": "Katherine Johnson", "city": "Osaka, Japan" }, "total": 2151.83 },
{ "order_id": "ORD-00002", "customer": { "name": "Ada Lovelace", "city": "Berlin" }, "total": 1783.46 }
]
And the TSV, with tabs shown as gaps:
order_id customer.name customer.city total
ORD-00001 Katherine Johnson Osaka, Japan 2151.83
ORD-00002 Ada Lovelace Berlin 1783.46
Not one quote character in the output, and the city with a comma in it is perfectly safe. As a CSV the same file would need two quoted fields and would be measurably harder to read.
Flattening, and the tab that was already in your data
Nested objects become dotted columns, so "customer": { "city": "Osaka" } becomes customer.city. Nesting past four levels stays as JSON text in one cell, and an array of objects stays as JSON text rather than being spread into extra rows, because spreading changes the row count silently.
The one case that needs care is a tab inside a JSON string, which does happen in text pasted from somewhere else. Such a value is quoted, exactly as a comma-bearing value would be in a CSV, so the columns stay aligned. It is rare enough that most files have no quotes at all.
A newline inside a value is quoted for the same reason, and survives as a real newline inside the field rather than being deleted.
Where a TSV goes next
- Straight into a spreadsheet by paste, which is the fastest route and needs no file at all.
- Into cut, awk and sort, all of which default to whitespace or tab handling and are much less fiddly than parsing CSV in a shell.
- Into a bulk loader that expects a tab delimiter, which several database import commands default to.
- Into a diff, where a tab-separated file with no quoting produces a far more readable change than a CSV whose quoting shifts when one value gains a comma.
Frequently Asked Questions
Why is nothing quoted in my output?
Because nothing needed it. Quoting protects the separator, and in a tab-separated file the separator is a tab. A value with a comma, a semicolon or a pipe in it is written plainly, which is what makes a TSV so much easier to read than the equivalent CSV.
What if a value actually contains a tab?
Then it is quoted, exactly as a comma-bearing value would be in a CSV, so the columns stay aligned. It is uncommon, so most files come out with no quote characters at all.
Can I paste the result straight into Excel?
Yes, that is one of the main reasons to use tab-separated output. Spreadsheets accept tab-separated text from the clipboard and fill the grid with it. A CSV pasted the same way lands in a single column.
How are nested objects handled?
They flatten into dotted columns, so a nested customer becomes customer.name and customer.city. Nesting past four levels and arrays of objects stay as JSON text in a single cell rather than changing the shape of the file.
Is this the same as CSV with a different separator?
Structurally yes, and the difference in practice is the quoting. A converter that reuses its CSV quoting rules for tab output wraps values that contain commas, which puts quote characters into your data for no reason. This decides quoting against the separator being written.
Does the file end with a newline?
Yes, exactly one. A file whose last line has no terminator makes wc undercount it, makes cat of two files glue two rows together, and makes some tools drop the final row outright.
Tab-separated, with the quoting done right
Flattened columns, no quotes for commas, paste straight into a spreadsheet.
Back to the converter