TSV to JSON

Convert TSV data to JSON format instantly.

Tab-separated text, with or without a row of column names. Cells in quotes may hold tabs and line breaks; database exports (PostgreSQL COPY, MySQL INTO OUTFILE) put a backslash before them instead and write a missing value as \N.

Worth a look

Rate this tool

How useful was this tool?

TSV to JSON Converter

Paste or type tab-separated text into the box, load the Example, or Open a file (you can also drag it onto the page). It converts as you type.

The tool works out whether the first row holds column names and whether the cells are quoted the way spreadsheets write them. A line under the preview says what it found, and you can set both yourself under First row and Tabs and line breaks inside cells.

The result shows a preview of the first five rows, with counts for rows, columns and size. The full JSON appears below it, ready to Copy or Download .json.

The conversion runs in your browser. Nothing you paste or open is uploaded or stored.

The quickest way: paste from a spreadsheet

Select cells in Excel or Google Sheets, copy them, and paste them here. Spreadsheets copy cells as tab-separated text, so there’s no need to save a file first.

Here’s a product list copied from a spreadsheet set up for a European country, where decimals use a comma:

sku name weight_kg in_stock active warehouse.city
00731 Green tea, loose 0,25 120 true Lisbon
01244 Mug, large 0,4   false Porto

 

With JSON values, Decimal comma and dotted names as nested objects switched on, the result is:

[
  {
    "sku": "00731",
    "name": "Green tea, loose",
    "weight_kg": 0.25,
    "in_stock": 120,
    "active": true,
    "warehouse": {
      "city": "Lisbon"
    }
  },
  {
    "sku": "01244",
    "name": "Mug, large",
    "weight_kg": 0.4,
    "in_stock": null,
    "active": false,
    "warehouse": {
      "city": "Porto"
    }
  }
]

What happened:

  • The commas in the names caused no trouble. In TSV only tabs separate cells, so “Mug, large” needs no quotes.
  • The SKUs stayed text. As numbers, 00731 would lose its leading zeros.
  • 0,25 became the number 0.25. That’s the decimal comma option at work.
  • The empty stock cell became null.
  • warehouse.city became a nested object.

Tabs and line breaks inside cells

Plain TSV has no way to put a tab or a line break inside a cell, because those characters separate cells and rows. Programs work around it in two ways, and the tool can read either one.

None (plain TSV). Every tab starts a new cell and every line break starts a new row. Quotes are ordinary characters, so a value like 12" pizza stays exactly as written.

Quoted like CSV. This is how spreadsheets do it. When you copy a cell that contains a line break, Excel and Google Sheets wrap it in double quotes, and any quote inside the cell is doubled. The tool reads the whole quoted value as one cell, line break included.

Backslash escapes (t, n). This is how databases do it. PostgreSQL’s COPY and MySQL’s export write a tab as t, a line break as n and a backslash as \. Choose this for database exports, and the codes turn back into real characters.

Find out for me detects quoted cells, but never assumes backslash escapes. A file listing C:newtemp would otherwise come out with a line break and a tab in the middle of the path. If cells contain t or n as text, a note points you to the option, and you decide.

Values: JSON types or text

Cells are read by the same rules as in CSV to JSON:

  • Numbers are kept exactly as written. 1.50 stays 1.50, and long integers keep every digit.
  • Values that only look like numbers stay text. That includes anything with a leading zero or a plus sign, such as ZIP codes, product codes and phone numbers.
  • true, false and empty cells become JSON true, false and null.

Switch off Numbers, true/false and empty cells as JSON values to keep every cell as text, exactly as it appears.

Decimal comma is for exports from countries where 4,5 means four and a half. With it on, 4,5 becomes 4.5 and 1.234,50 becomes 1234.5. The dot is treated as a thousands separator, so leave the option off for files that use dots for decimals.

Messy headers and uneven rows

Column names are cleaned up. Spaces around names are trimmed. Empty names and repeated names are numbered, so every key in the JSON is unique. Without that, two columns both called price would overwrite each other, and one of them would silently disappear.

No row is dropped. A row with too few cells gets empty values for the missing ones. A row with too many adds extra columns at the end. Each case comes with a note, because uneven rows usually mean something went wrong in the export, such as a tab inside a value that should have been quoted.

Back from JSON to TSV

With Dotted column names become nested objects on, names like address.city become nested objects and names like tags.0 become lists. A file made by JSON to TSV with nested values as columns comes back with its structure. You can go from JSON to a spreadsheet, edit it there, and return to JSON.

One limit: if the TSV was made with One row per list item, each row comes back as its own object. The tool doesn’t regroup rows into their original parent, such as items into orders.

Output

Pretty print formats the JSON with two-space indentation, which is easy to read. Switch it off to get everything on one line, which is smaller and better for sending to an API.

The download is named after the file you opened, so products.tsv becomes products.json.

If you paste comma-separated text by mistake, a note says so and links to CSV to JSON.

FAQ

Can I paste straight from Excel or Google Sheets?

Yes. Copying cells puts them on the clipboard as tab-separated text, which is exactly what this tool reads. Cells with line breaks come quoted, and the tool detects that.

How do I convert a PostgreSQL or MySQL export?

Set Tabs and line breaks inside cells to Backslash escapes (t, n). Exports from COPY or SELECT ... INTO OUTFILE write special characters that way.

Why is my number in quotes?

It has a leading zero or a plus sign, so turning it into a number would change it. If the file uses decimal commas, switch on Decimal comma so values like 4,5 are read as numbers.

Can I convert JSON back to TSV?

Yes, with JSON to TSV.

Is my data uploaded anywhere?

No. Everything happens in your browser, and nothing you paste or open is stored.

Note: All processing is done client-side. We do not store or see your data.

Contact

Missing something?

Feel free to request missing tools or give some feedback using our contact form.

Contact Us