HTML Table to JSON Converter
Extract text from the first HTML table and convert rows into predictable JSON objects with safe header handling.
Privacy: your files never leave your device. All processing happens locally in your browser.
How to use
- 1.Paste HTML containing the target table and choose whether the first row contains headers.
- 2.Choose whether to trim surrounding cell text, then convert the first table.
- 3.Inspect row and column counts, copy the JSON, and validate types with the destination schema.
About HTML Table to JSON Converter
HTML Table to JSON Converter extracts the text of cells from the first table in supplied HTML and converts the resulting rows into JSON objects. By default, the first row provides property names and later rows become records. Disable that option to keep every row and generate column_1, column_2, and subsequent keys. Optional trimming removes surrounding whitespace from headers and cell text while preserving internal spaces and line content.
The browser parses the string as an inert HTML document and exposes the standard table rows and cells collections. The converter reads textContent only. It does not copy markup, attributes, links, styles, event handlers, comments, or dataset values into JSON. To reduce resource and active-content surprises, input containing script, style, images, frames, audio, video, source, link, object, embed, SVG, or MathML elements is rejected before parsing. No preview is rendered.
Header handling is deterministic. An empty heading becomes its generated column name. Duplicate names receive numeric suffixes in encounter order, so A, A, A becomes A, A_2, A_3 rather than overwriting data. If later rows have more cells than the heading row, additional generated columns preserve those values. Missing trailing cells become empty strings so every output record has the same key set. A heading-only table correctly produces an empty JSON array.
Cell values remain strings. The converter does not guess numbers, dates, booleans, null, currencies, percentages, locales, or formulas because textual appearance is not a reliable type declaration. Leading zeros, large identifiers, postal codes, and account references can be damaged by automatic numeric coercion. Apply a schema-aware validation step after conversion when typed output is required. Empty cells remain empty strings rather than null for the same reason.
Complex table layout is outside scope. The browser row and cell collections identify cells, but this tool does not expand rowspan or colspan into a rectangular visual grid. Nested tables can also create ambiguous ownership and should be removed before conversion. The result follows encountered cell order, not a screen reader's complete accessibility interpretation or a spreadsheet import algorithm. Normalize complex source tables in their originating application when visual spans carry meaning.
The first matching table is converted intentionally. Captions, thead, tbody, tfoot, and ordinary row groups participate through the browser's row order, but subsequent tables are ignored. If a document contains navigation, pricing, comparison, and data tables, isolate the target markup first. Malformed HTML may be repaired by the browser parser, so the extracted structure can differ from the literal source. Inspect the summary and JSON rather than assuming the original tags were well formed.
Input is limited to 500,000 characters to bound parsing and serialization work. All parsing, extraction, JSON formatting, and clipboard writes occur in the current tab; the markup and result are not uploaded. HTML can contain personal or confidential table data, so remove sensitive rows before sharing the JSON. Browser extensions and the local device remain outside this page's privacy boundary.
Eight independent fixtures lock normal headers, missing cells, extra cells, blank headers, duplicate headers, trimming, empty records, and heading-only tables. Additional tests cover generated headers and empty input. For reliable use, paste only the target table, choose the header policy, convert, compare row and column counts, inspect representative records, and then apply a schema validator before importing the JSON into a database or API.
Methodology & sources
Parses a bounded inert HTML document, rejects executable or resource-loading elements, reads textContent from the first table's standard row and cell collections, repairs blank/duplicate headers deterministically, fills missing cells, and emits strings without type guessing.
Frequently asked questions
- How are duplicate or blank column headings handled?
- Blank headings receive generated column names. Later duplicates receive _2, _3, and further suffixes so values are not overwritten.
- Does the converter understand rowspan and colspan?
- No. It reads encountered cells and does not expand visual spans into a rectangular grid. Normalize complex tables before conversion.
- Are numbers and dates converted to JSON types?
- No. Every cell remains a string to protect identifiers, leading zeros, locale-specific values, and large numbers. Apply an explicit schema afterward.
Related tools
- HTML CleanerNormalize an HTML fragment through the browser parser and optionally remove comment nodes without previewing or executing the result.
- JSON FormatterFormat, minify, and validate JSON in your browser β pretty-print or compress with pinpoint error locations.
- CSV To JSONParse a bounded RFC 4180-style comma file locally and export string-preserving JSON without losing quoted commas, quotes, or line endings.
- XML to JSON ConverterConvert bounded, well-formed XML into readable JSON locally with attributes, text, namespaces, and repeated elements preserved.
- ANSI Color Codes GeneratorBuild and copy raw SGR escape sequences and search the standard 8 plus bright 8 terminal color codes.
- ASCII TableLook up every standard 7-bit ASCII code with exact decimal, hexadecimal, octal, and binary values.