TSV to JSON Converter
Paste or upload tab-separated values and get a JSON array and a table. Handles spreadsheet quotes, CRLF, duplicate headers and ragged rows.
The interactive tool loads here when JavaScript runs.
About this toolWhat is the TSV to JSON Converter?
The TSV to JSON Converter turns tab-separated values into a JSON array of objects, one per row, keyed by the header line. It also shows the data as a table, so you can check that columns lined up before you copy or download the JSON.
Parsing is done by papaparse with a tab delimiter. Windows (CRLF) line endings and a UTF-8 byte order mark are handled. Spreadsheet-style quotes are on by default, so a field exported by Excel or Google Sheets as "line one" followed by a line break and "line two" stays one field. Untick the option for strict IANA TSV, where quote characters are ordinary data.
Values stay strings, exactly as they appear, including leading zeros and spaces. Rows with too few or too many fields are reported, duplicate or blank headers are renamed, and nothing is dropped silently.
- TSV to JSON array of objects plus a table view
- Spreadsheet quotes on or off for strict IANA TSV
- CRLF, BOM, blank and duplicate header handling
- Warnings for rows with the wrong number of fields
- Copy or download JSON; parsing runs in your browser
Updated
How to use the TSV to JSON Converter
- Paste TSV into the TSV Input box, click Upload File for a .tsv or .txt file, or click Sample Data.
- Leave Spreadsheet-style quotes ticked for Excel or Google Sheets exports; untick it for strict TSV where " is a normal character.
- Click Parse TSV.
- Check the Table tab and any warnings about rows with the wrong number of fields.
- Copy JSON or Download it as converted-data.json.
Worked examples
A quoted field from a spreadsheet
Input
sku name note A-1 Widget "fits 1/2"" pipe" B-2 Gadget
Output
[{"sku": "A-1", "name": "Widget", "note": "fits 1/2\" pipe"}, {"sku": "B-2", "name": "Gadget", "note": ""}]The doubled quote inside the quoted field becomes one quote. With the quotes option off, the note is kept literally as "fits 1/2"" pipe" including all the quote marks.
Duplicate headers and an extra field
Input
id id 1 2 3 4
Output
[{"id": "1", "id_2": "2", "column_3": "3", "extra_1": "4"}]Renaming keeps every value. A plain object would have overwritten the first id, and a row with more fields than the header would have lost its last value.
Background and insight
TSV is registered with IANA as text/tab-separated-values. The registration, from the University of Minnesota Gopher team in 1993, is short: the first line holds field names, a tab separates fields, a line break ends a record, every record has the same number of fields, and a field may not contain a tab or a line break. There is no quoting and no escape mechanism. That simplicity is the point, because a tab almost never appears in ordinary data.
Real-world TSV is messier. Spreadsheet exports borrow CSV's rule from RFC 4180 and wrap fields containing tabs, line breaks or quotes in double quotes, doubling any quote inside. Database tools such as PostgreSQL COPY and MySQL instead write backslash escapes like \t and \n. Before parsing, find out which convention produced your file; the quote option in this tool covers the first two.
TSV's biggest practical advantage over CSV is that commas, which appear in names, addresses and numbers, need no quoting. That is why TSV is common for copy and paste between spreadsheets and terminals, for bioinformatics files, and for search engine and analytics exports.
Common use cases
Pasting from a spreadsheet
Copy cells from Excel or Google Sheets, which put tabs between them, and turn them into JSON for a fixture or API call.
Reading data exports
Convert TSV exports from analytics, search consoles or ad platforms into JSON for a script.
Checking a file before import
Find ragged rows and stray quotes before loading a TSV into a database.
Scientific data
Inspect small bioinformatics or lab instrument TSV files as a table.
Tips and limitations
- All values are strings. Convert numbers and booleans in your own code so 007 and 1e5 are not reinterpreted by accident.
- If quotes appear in the middle of fields and parsing looks wrong, untick spreadsheet-style quotes.
- Backslash escapes such as \t are not unescaped; files from PostgreSQL COPY keep them literally.
- Empty lines are skipped. A line with only tabs is a real row of empty fields.
- For comma-separated files use the CSV to JSON converter, which handles CSV quoting rules and type options.
Sources and further reading
- Media type text/tab-separated-values, Internet Assigned Numbers Authority. The 1993 University of Minnesota registration
- TSV, Tab-Separated Values, Library of Congress. Format description, history and the variants seen in practice
- RFC 4180: Common Format and MIME Type for Comma-Separated Values (CSV) Files, Internet Engineering Task Force. The CSV quoting rule many spreadsheet TSV exports borrow
- COPY, PostgreSQL Global Development Group. The text format with backslash escapes such as \t and \n
Frequently asked questions
How do I convert TSV to JSON?
Paste the tab-separated text into TSV Input, or upload the file, and click Parse TSV. The first line becomes the keys and every following line becomes one object in a JSON array, which you can copy or download as converted-data.json.
Can a TSV field contain a tab or a line break?
Not in strict IANA TSV, which forbids both and has no quoting. Spreadsheet exports work around this by wrapping such fields in double quotes, and this parser reads those when Spreadsheet-style quotes is ticked. Some database exports use backslash escapes instead.
Why are my numbers strings in the JSON output?
TSV carries no type information, so every value is kept exactly as written. That protects ZIP codes with leading zeros, long IDs and version numbers. Convert the fields you need with Number() or parseInt in your code.
What happens when a row has more fields than the header?
The extra values are kept under keys named extra_1, extra_2 and so on, and a warning gives the line number. Rows with fewer fields get empty strings for the missing columns and are flagged too.
Is TSV better than CSV?
TSV is simpler to parse because tabs rarely appear in data, so commas in names and numbers need no quoting. CSV is more widely supported by tools and has a defined quoting rule in RFC 4180. Use TSV for copy and paste and simple exports, CSV for exchange with other systems.
Does it handle files saved on Windows?
Yes. CRLF line endings are treated like LF, so no stray carriage return is left at the end of the last field, and a UTF-8 byte order mark at the start of the file is removed from the first header.
Is there an in-depth guide to the TSV to JSON Converter?
Yes. “TSV Files: The Format Rules, Quoting Traps and TSV vs CSV” covers the background, how it works, common pitfalls and worked examples. Read the full guide.
Related Tools You May Like
Free, in-browser tools that pair well with this one.