JSON Toolbox LogoJSONToolbox

HTML Table to JSON Converter

Convert HTML tables into JSON arrays in your browser. Paste HTML or open an .html file, pick the table, choose how headers are detected, preview the rows, optionally infer basic types, then copy or download the JSON.

Table Preview
JSON output will appear here...
JSON output will appear here...
All processing happens in your browser. No JSON is sent to our servers.

Key Features

HTML Table to JSON

Extract table headers and rows from HTML and turn them into a JSON array of objects, one object per table row, using cell text content.

Pick the Right Table

See how many tables the input contains and convert the one you select by index. Rows belonging to a table nested inside a cell stay with that nested table.

Header Detection

Use header cells found in thead or a leading row of th elements, force the first row to be the header, or generate column_1, column_2, and so on.

Preview Rows and Columns

Preview the detected headers and the first 10 data rows before exporting, together with the row, column, and table counts.

Optional Type Inference

When enabled, lowercase true and false become booleans and plain integers or decimals become numbers. It is off by default, so values such as 00123 and SKU-001 stay strings.

Structural Warnings

Get warned about colspan and rowspan, duplicate or empty header names, tables with more than one header row, and rows with a different number of cells.

Copy JSON Output

Copy the generated JSON array to the clipboard for scripts, APIs, databases, or data-processing workflows. Copy always includes every row, not just the previewed ones.

Download JSON

Download the extracted table data as a .json file for local storage, analysis, testing, or further conversion.

Browser-Based Processing

HTML parsing and JSON generation happen in your browser. No account is required and the input HTML is not sent to a remote service.

How to Use

1

Enter HTML

Paste HTML that contains a table, or open a local .html, .htm, or .txt file. This page is built for table markup, not for fetching or crawling a remote page.

2

Pick the table

When the input contains more than one table, choose which one to convert. The number of tables found is shown above the preview.

3

Configure headers and values

Choose whether headers are detected from th elements, taken from the first row, or generated. Decide whether to trim cell text, infer basic types, or turn empty cells into null.

4

Review the preview

Check the detected headers, the first 10 rows, the row and column counts, and any warning about spans, renamed headers, or uneven rows.

5

Convert and export

Click Convert to JSON, then copy the result or download it as a .json file. The output also updates automatically while you type.

Convert an HTML Table to JSON

A basic table with a header row, converted into an array of JSON objects.

Input HTML
<table>
  <thead>
    <tr><th>Name</th><th>Age</th><th>City</th></tr>
  </thead>
  <tbody>
    <tr><td>Alice</td><td>30</td><td>New York</td></tr>
    <tr><td>Bob</td><td>25</td><td>London</td></tr>
  </tbody>
</table>

A thead section with three th cells and a tbody with two data rows.

JSON Array
[
  {
    "Name": "Alice",
    "Age": "30",
    "City": "New York"
  },
  {
    "Name": "Bob",
    "Age": "25",
    "City": "London"
  }
]

Default options: headers detected from thead, type inference off, so 30 and 25 stay strings.

Turn on Infer basic types to output 30 and 25 as JSON numbers. The preview shows the first 10 rows; copy and download always include every row.

How to Convert an HTML Table to JSON

What Is HTML Table to JSON Conversion?

HTML Table to JSON conversion parses HTML markup and represents table data as JSON. The usual result is an array of objects: each table row becomes one object, and each column becomes a property.

This is different from representing a whole document as a JSON DOM tree with tags, attributes, text, and children. This page extracts tables only; it does not serialize an entire page.

How to Convert an HTML Table to JSON

  1. Enter HTML: paste markup containing a table, or open a local .html or .htm file.
  2. Pick the table: when several tables are present, select the one you need.
  3. Detect headers: use th cells, force the first row, or generate column names.
  4. Configure values: trim text, infer basic types, or turn empty cells into null.
  5. Review warnings: check spans, renamed headers, and uneven rows.
  6. Convert: generate a JSON array of objects.
  7. Copy or download: save the result as a .json file.

Example HTML Table

Input:

<table>
  <thead>
    <tr><th>Name</th><th>Age</th></tr>
  </thead>
  <tbody>
    <tr><td>Alice</td><td>30</td></tr>
  </tbody>
</table>

Output with the default options:

[
  {"Name":"Alice","Age":"30"}
]

Age stays the string "30" because type inference is off by default. Turn it on to get the number 30.

Header Handling

Column names can come from an explicit thead section, from a leading row of th cells, or from generated names. When a header cell is empty it becomes column_N for that position, and a repeated name gets a numeric suffix such as Name_2, so no column is silently dropped. Both cases are reported as a warning.

If a table has more than one header row, this page uses the first one and warns you, because grouped or stacked headings cannot be flattened unambiguously.

Why colspan and rowspan Matter

A cell with colspan="2" occupies two logical positions, and rowspan spans several rows. Correctly expanding them requires building a grid and filling every position a spanning cell covers. This version does not do that: it reads each row as written and warns when a span is present, so the column alignment can be checked by hand instead of being silently wrong.

Text Content, Not HTML

Values are read from cell text content. Tags inside a cell contribute their text, so <td><strong>Alice</strong></td> yields Alice. Markup and attributes such as href or src are not extracted. That keeps the output plain data, and it also means links and images inside a table are not part of the result.

Type Inference Can Change Values

Table cells are text, and text has no type. With inference enabled, lowercase true and false become booleans and plain integers or decimals become numbers. Values such as 00123, SKU-001, 1e5, and TRUE are never converted, so identifiers, postal codes, and formatted amounts stay intact. Keep the option off unless numeric types are what you need.

HTML to JSON Is Not Scraping

This tool parses HTML that you paste or open locally. It does not fetch URLs, run JavaScript, follow pagination, or evaluate access policies. For repeated extraction from live sites, a local scraper or a build-time step is the right tool; the browser converter is for saved markup, copied fragments, and one-off extraction.

Privacy and Browser-Based Processing

Parsing and conversion happen in the browser, so the HTML you paste stays on your device. That suits saved pages and exported markup, but it is not a secret-management system. Avoid pasting authenticated page content, credentials, or confidential customer data into any online tool.

When to Use a Local Parser

For many files, repeated jobs, very large documents, or confidential content, use a local HTML parser and keep the conversion in your own pipeline. Browser conversion is best for quick extraction, inspection, and small-to-medium tables.

Related Tools

Frequently Asked Questions

What does this HTML to JSON converter do?

It extracts HTML table rows and columns and converts them into a JSON array of objects. Each table row becomes one object, and the detected headers become property names.

Can I convert a complete HTML page to JSON?

This page extracts tables only. Everything outside a table element is ignored, because most page markup does not map to rows and columns. It does not fetch a URL and does not convert an entire page into a JSON document.

How are table headers detected?

Detect header row uses the first row inside thead, or a leading row whose cells are all th elements. First row is header forces the first row to be used. No header row generates column_1, column_2, and so on.

What if the HTML contains multiple tables?

The number of tables found is displayed, and you can pick which one to convert. Tables nested inside a cell are counted too and can be selected on their own.

Can I convert an HTML table without a header row?

Yes. Choose No header row and the converter generates column_1, column_2, column_3, and so on. Generated names work, but they are less descriptive than real headers.

Does it support rowspan and colspan?

No. This version does not expand cells that span several positions, because doing so requires a grid-expansion algorithm. When a colspan or rowspan attribute greater than 1 is found, the page warns you so the column alignment can be checked manually.

What happens to duplicate or empty header names?

An empty header becomes column_N for its position, and a repeated name gets a numeric suffix such as Name_2, so no column is silently dropped. Both cases raise a warning.

Does it preserve HTML inside table cells?

No. Cell text content is extracted, so tags such as a, strong, and span inside a cell contribute their text only. Markup inside cells is not kept, and there is no option to preserve it.

Does it infer numbers and booleans?

Only when Infer basic types is enabled, and only for a narrow set of values: lowercase true and false become booleans, and plain integers or decimals become numbers. Values such as 00123, SKU-001, 1e5, and TRUE stay strings, so keep the option off when identifiers or formatted amounts must remain text.

What happens to empty and missing cells?

A missing cell becomes an empty string, or null when Convert empty cells to null is enabled. Rows with a different number of cells than the header are still converted and are reported as a warning.

Can I extract table data from a URL?

No. Fetching a URL introduces CORS limits, remote-content and privacy concerns, and does not work for pages rendered by JavaScript. Paste the HTML or open a local file instead.

Can I convert HTML attributes to JSON?

No. Only cell text content is extracted. Attributes such as class, href, src, and data-* values are not converted, and there is no attribute mapping option.

Can I convert HTML to a JSON DOM tree?

No. This page converts tables into JSON records. A DOM tree mode that represents tags, attributes, text, and children is not available.

Is HTML to JSON the same as scraping a website?

No. This tool parses HTML you supply. Scraping a website usually means fetching URLs, running JavaScript, handling pagination, and respecting access policies, none of which this page does.

Can I convert JSON back to HTML?

Use the JSON to HTML page for the reverse direction. A JSON array of objects can be rendered back into rows and columns.

Can I convert a large HTML file?

The practical limit depends on document size, number of tables, DOM complexity, browser memory, and preview rendering. Large pages may be better handled with a local parser.

Is my HTML uploaded to a server?

No. The page parses HTML and generates JSON in your browser. You should still avoid pasting private customer data, authenticated page content, credentials, or confidential HTML into any browser-based tool.

Is this a free HTML to JSON converter?

Yes. You can paste or open HTML, extract table data, review the result, and copy or download JSON without creating an account.