Skip to content
UniKit

HTML table to JSON

Paste table HTML or table text copied from a web page or Excel, expand colspan/rowspan merged cells, and export a JSON array, CSV or Markdown table.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

First row is the headerWhen off, field names become column1, column2…

Cells covered by colspan/rowspan repeat the same text so every row is equally long

Result

What this tool does

  • Turn a table’s markup (a `<table>` copied out of the inspector) into a JSON array for front-end mocks or test fixtures.
  • Paste a column copied out of Excel or a spreadsheet and get JSON, CSV or Markdown output directly.
  • Writing docs? Convert a table to Markdown instead of hand-adding pipes and the alignment row.
  • Tables with colspan / rowspan need no preparation: covered cells repeat the same text so every row comes out equally long.

Example

Input

<table><tr><th>名称</th><th>数量</th><th>备注</th></tr><tr><td>螺丝</td><td>120</td><td>M4 × 8</td></tr><tr><td>螺母</td><td>80</td><td>&nbsp;</td></tr></table>

Output

[
  {
    "名称": "螺丝",
    "数量": "120",
    "备注": "M4 × 8"
  },
  {
    "名称": "螺母",
    "数量": "80",
    "备注": ""
  }
]

Every cell is a string — numbers are not converted to JSON numbers, which protects leading zeros in order IDs. &nbsp; is decoded to a non-breaking space and then trimmed, so the second row’s note is an empty string.

Frequently asked questions

How does it detect delimiters in plain table text rather than HTML?

Tabs win: any line containing \t is split on tabs, which is the format Excel puts on the clipboard. Without tabs it splits on runs of two or more spaces. If the first line contains a pipe and the second looks like |---|, it is treated as a Markdown table and the alignment row is skipped.

Are numbers converted to JSON numbers?

No, every value stays a string. "120" remains "120" and "007" does not become 7, which matters for phone numbers, order IDs and postal codes. Convert on the consuming side when you need real numbers.

What happens with duplicate or empty header cells?

Empty headers are filled in as column1, column2… and duplicates get a suffix (name, name_2) so every key inside an object is unique. Turning off "First row is the header" makes all fields column1, column2… instead.

Why does it report "Cannot parse the HTML"?

It fires when HTML tags are present but `<table>` or `</table>` is missing, or when an attribute quote is never closed. Only the first complete `<table>` is parsed; nested inner tables are skipped so they are not mistaken for the outer one.

Is my input uploaded?

No. The tool ships a small HTML tokenizer and does all parsing and conversion in the browser, with no network requests and no fetching of the page you copied from.

Keywords:tablehtml tablejsoncsvmarkdown表格转换colspanrowspan合并单元格exceltable to json

Related tools