Skip to content
cliplimeClipLime

Convert TSV to JSON

Paste tab separated text or cells copied from a spreadsheet and get JSON, with numbers typed by column.

Runs on your device, nothing is uploaded

Convert from

to

Paste, type, drop a file here or load one.

0 characters, 0 lines

Options

When off, columns are called column1, column2 and so on.

A column becomes numbers only if every filled cell in it is a clean number. All types also reads true/false, and empty cells and the words null and NULL become null.

Columns such as address.city become nested objects, and tags.0, tags.1 become a list.

Write each row as

A list per row starts with the column names when they are on.

Indentation

More options

The dot in address.city.

Empty cells do not create a key.

At a glance

Input
Tab separated text pasted from a spreadsheet, or a .tsv, .tab or .txt file. The input is always split at tabs, with no guessing.
Header
The first row of your selection supplies the keys. With the header option off, the keys are column1, column2 and so on, or you can write plain lists.
Types
Numbers, true and false and empty cells are typed column by column, and an empty cell becomes null. Prefer text? Choose Keep as text.
IDs
Values with leading zeros, such as 007, and numbers with more than 15 digits stay text so nothing is changed.
Nested JSON
A header like address.city nests its value inside an address object, and tags.0, tags.1 build a list.
Database exports
Backslash codes such as \N for an empty value are not decoded. They stay as the text you see.
Output
Objects or lists, indented the way you like. Copy the result or save it as a .json file.

How to do it

  1. 1

    Add your TSV

    Paste tab separated text, for example cells copied from Excel or Google Sheets, or drop a file on the box. You can also press Load a file.

  2. 2

    Choose how to read it

    Leave First row has the column names on when your selection starts with the header row. Under Cell values, decide whether numbers and true and false become real JSON values or stay text.

  3. 3

    Pick the shape

    Choose between one object per row, keyed by the header, and a plain list of values per row. Dotted headers can be rebuilt into nested objects or left as flat keys.

  4. 4

    Copy or download

    Copy the JSON or download a .json file. The notes under the result list anything that was renamed, padded or left out.

Where tab separated data comes from

TSV turns up wherever text may contain commas. Cells copied from Excel or Google Sheets reach the clipboard as tab separated text, so a selection from a spreadsheet can go straight into the input box. Database tools, command line programs and statistics software often export tab separated tables for the same reason: a tab almost never appears inside a name, an address or a sentence, so the file needs little or no quoting.

Because a tab is so rarely part of the data, this page always splits at tabs and does not try to guess a delimiter. If the text turns out to have commas or semicolons instead, a notice offers to switch the input format to CSV.

How cells become JSON values

A TSV has no types, so the converter decides one column at a time. A column becomes numbers only when every filled cell in it is a clean number: digits with an optional minus sign and decimal point, no leading zeros and at most 15 digits. A column of true and false becomes booleans, and empty cells become null. Anything else stays text, and one stray word keeps a whole column as text, so a column never mixes numbers and words.

  • A column of 19.99, 5 and -0.5 becomes the numbers 19.99, 5 and -0.5, and 3.50 is written as 3.5.
  • Product codes such as 007 and ZIP codes such as 02134 stay text, so they keep their zeros.
  • An ID such as 12345678901234567890 stays text, since a JSON number is only exact up to about 15 digits.
  • Values such as 1,5 and 1.234,50 stay text, because the same characters are a different number in different countries.
  • \N, the empty value marker of PostgreSQL and MySQL text exports, stays the two characters \N. The words null and NULL do become null when all types are detected.

Choose Keep as text if you need every cell exactly as written.

Quotes, backslashes and uneven rows

Quotes are read the CSV way: a cell wrapped in double quotes may hold tabs and line breaks, and two quote marks in a row stand for one. A quote mark inside an unquoted cell, as in 5" pipe, is kept as it is. Backslash codes such as \t and \n are not decoded, because in many files a backslash is just a backslash.

Rows shorter than the header are filled with empty cells, so those keys are null. A row with extra values gets extra keys called column4, column5 and so on. A repeated header such as name, name becomes name and name_2, and rows with no content are skipped. Every repair is listed in the notes under the result.

Getting the JSON shape you want

You shape the JSON with the header cells of your spreadsheet. Headers called name, address.city, address.zip, tags.0 and tags.1 produce {"name": ..., "address": {"city": ..., "zip": ...}, "tags": [..., ...]} for every row. Empty items at the end of a list are dropped, and Leave out empty cells under More options stops an empty cell from creating a key.

Turn off Rebuild nested values from column names to keep the headers as flat keys. Choose A list under Write each row as to get one JSON list per row, with the column names as the first list. That is much smaller for big tables, because the keys are not repeated on every row.

Questions people ask

How do I convert a TSV file to JSON?

Paste the tab separated text, or drop the file on the input box. The first row becomes the keys and each following row becomes an object in a list. Copy the JSON or download it as a .json file.

Can I paste cells straight from Excel or Google Sheets?

Yes. Copied cells are tab separated text, so paste them into the input box. The first row of your selection becomes the keys, so include the header row when you select.

Why are my numbers strings in the JSON?

Each column is judged as a whole. If detection is on and a column still comes out as text, at least one filled cell in it is not a clean number: a footer row such as Total, an n/a, a stray space, a thousands separator, a leading zero or an ID longer than 15 digits. Find that cell and fix it, and the column turns into numbers. With Keep as text selected, no column is ever converted.

My file has no header row. Can I still convert it?

Yes. Switch off First row has the column names and the first row is read as data, with the keys called column1, column2 and so on. If you would rather have no keys at all, choose A list under Write each row as.

What about \N for empty values in a database export?

It stays the text \N, because the converter does not decode backslash codes. Replace \N with nothing in a text editor before you convert, and the cells will be empty, which become null.

Is my data uploaded?

No. Pasted cells and dropped files are parsed and turned into JSON inside this tab, and nothing is sent anywhere.