How to use the tsv to json converter
- Paste your TSV data into the input area.
- Choose whether the first row is a header row.
- Select the delimiter if your file uses something other than tabs.
- Toggle skip empty rows if you want to ignore blank lines.
- Copy the JSON output from the result box.
How the tsv to json parser works
The converter implements a strict RFC 4180 parser adapted for tab delimiters. It scans the input character by character, tracking whether it is inside a quoted field. Inside quotes, a doubled quote ("") becomes a single quote in the output, and the delimiter or newline is treated as literal data. Outside quotes, the delimiter splits fields and a newline (LF or CRLF) ends the row.
When First row is header is checked, the first parsed row becomes the property names for every subsequent row. If a row has fewer fields than the header, the missing values are null. If it has more, the extra values are dropped with a warning in the note. When unchecked, every row becomes an array; ragged rows are padded with null so all inner arrays share the same length.
Common TSV patterns and their JSON
This table shows how typical TSV constructs map to JSON.
| TSV input | Header | JSON output |
|---|---|---|
a\tb\nc\td | yes | [{"a":"c","b":"d"}] |
a\tb\nc\td | no | [["a","b"],["c","d"]] |
"hello\nworld"\tfoo | no | [["hello\nworld","foo"]] |
"She said ""Hi""" | no | [["She said \"Hi\""]] |
a\tb\nc\t | yes | [{"a":"c","b":""}] |
a\tb\nc\td\te | yes | [{"a":"c","b":"d"}] (extra dropped) |
When to use TSV instead of CSV
TSV avoids the quoting complexity of CSV when your data contains commas but rarely contains tabs. Log files, database exports, and spreadsheet copies often use tabs naturally. The parser here also accepts comma, semicolon, or pipe delimiters so you can convert those formats to JSON without a separate tool.
If your data already has tabs inside fields, consider a different delimiter or ensure those fields are quoted. The parser will treat an unquoted tab as a field separator.
Handling large inputs
The parser runs in a single pass over the text, so time grows linearly with input size. It runs on the main thread, so very large pasted inputs (tens of megabytes) can make the page slow. For big files, use a streaming parser in Node or Python; this tool is designed for interactive use.
Common mistakes
- Forgetting to quote fields with newlines. An unquoted newline ends the row, shifting all subsequent fields.
- Using a single quote instead of doubled quotes. RFC 4180 requires
""inside a quoted field; a lone quote is treated as the closing quote. - Mixing CRLF, LF and bare CR. The parser accepts all three as row endings.
- Assuming all rows have equal columns. Ragged rows are real; the tool pads with
nullso downstream code can rely on consistent array lengths.
Worked examples
| Example | Input | Result |
|---|---|---|
| Simple table with header | TSV input: name age city / Alice 30 New York / Bob 25 Los Angeles; First row is header: yes; Delimiter: \t; Skip empty rows: no | [{"name":"Alice","age":"30","city":"New York"},{"name":"Bob","age":"25","city":"Los Angeles"}] |
| Quoted fields with embedded tab and newline | TSV input: id description / 1 "Line 1 / Line 2" / 2 "Has tab"; First row is header: yes; Delimiter: \t; Skip empty rows: no | [{"id":"1","description":"Line 1\nLine 2"},{"id":"2","description":"Has\ttab"}] |
| No header, ragged rows | TSV input: a b c / d e / f g h i; First row is header: no; Delimiter: \t; Skip empty rows: no | [["a","b","c",null],["d","e",null,null],["f","g","h","i"]] |
| Doubled quotes inside quoted field | TSV input: text / "She said ""Hello"""; First row is header: yes; Delimiter: \t; Skip empty rows: no | [{"text":"She said \"Hello\""}] |
| CRLF line endings | TSV input: x y / 1 2 / 3 4; First row is header: yes; Delimiter: \t; Skip empty rows: no | [{"x":"1","y":"2"},{"x":"3","y":"4"}] |
FAQ
Does this tool send my data to a server?
No. The conversion runs entirely in your browser using JavaScript. Nothing is uploaded.
Can I convert CSV with this tool?
Yes. Choose Comma (,) from the delimiter dropdown. The same RFC 4180 parser handles quoted commas and newlines correctly.
Why does my output have null values?
Null appears when a row has fewer fields than the header (or the longest row in array mode). This preserves alignment so you can detect missing data programmatically.
What happens if a row has more fields than the header?
Extra fields are dropped. A note in the result tells you how many rows were trimmed.
Does the parser support comments or metadata lines?
No. RFC 4180 does not define comments. Lines starting with # or // are parsed as regular data.
Can I get the output as JSON Lines (NDJSON)?
This tool outputs a single JSON array. For NDJSON, copy the array and replace },{ with }\n{ in your editor, or use a dedicated NDJSON tool.
Is there a size limit for tsv to json conversion?
The only limit is browser memory. Very large pastes can make the page slow because the work runs on the main thread.