TSV vs CSV: converting tab-separated values to JSON
TSV is just “CSV with tabs”. The big difference is visual: tabs are invisible, so TSV often looks like one column until you parse it correctly.
What is TSV?
TSV stands for Tab-Separated Values. It uses a tab character as the delimiter. Many systems export TSV to avoid quoting complexities because tabs are less common inside values than commas.
Why TSV looks “broken” in editors
- Tabs can render as irregular spacing, especially with proportional fonts.
- Some viewers replace tabs with spaces, destroying alignment.
- Copy/paste can collapse multiple tabs.
Conversion workflow
- Paste TSV into a converter that supports tab delimiter (auto-detection helps).
- Confirm headers split into multiple columns.
- Convert to JSON and inspect a few rows.
Trust note: All processing happens locally in your browser. Files are never uploaded.
Practical checklist (fast)
If you’re stuck, use this quick checklist to narrow the problem before you try “random fixes”. Start by validating the input format (syntax first), then confirm shape expectations (array vs object, headers vs rows). Convert a small sample, inspect the output, and only then export the full result.
- Validate: confirm the input is strict JSON/XML/CSV (no stray characters).
- Confirm shape: arrays vs objects; headers vs row lengths; repeated tags vs arrays.
- Test a sample: first 20–50 rows/items are enough to detect parsing issues.
- Export: copy/download the output and re-check it in the consumer (script/spreadsheet/API).
This workflow is privacy-first by design: All processing happens locally in your browser. Files are never uploaded.
Practical checklist (fast)
If you’re stuck, use this quick checklist to narrow the problem before you try “random fixes”. Start by validating the input format (syntax first), then confirm shape expectations (array vs object, headers vs rows). Convert a small sample, inspect the output, and only then export the full result.
- Validate: confirm the input is strict JSON/XML/CSV (no stray characters).
- Confirm shape: arrays vs objects; headers vs row lengths; repeated tags vs arrays.
- Test a sample: first 20–50 rows/items are enough to detect parsing issues.
- Export: copy/download the output and re-check it in the consumer (script/spreadsheet/API).
This workflow is privacy-first by design: All processing happens locally in your browser. Files are never uploaded.
FAQ
Should I convert TSV to CSV first? Not required. You can convert TSV directly to JSON with the correct delimiter.
Why do some rows still mismatch? TSV can still contain tabs inside values—rare, but possible. Quoting rules still matter.
Local verification snippet
Run a quick local check before export/convert:
import csv
from io import StringIO
sample = text[:50000] # keep first chunk for fast local triage
rows = list(csv.reader(StringIO(sample)))
print('rows:', len(rows), 'columns(first row):', len(rows[0]) if rows else 0)