HTML Table to JSON Converter

Convert an HTML table into a JSON array of objects, using the header row as keys.

HTML
JSON
Runs locally in your browser

About the HTML Table to JSON Converter

Once you have the HTML of a table, converting it to JSON gives you something code can use directly. This tool parses the markup, takes the first row (or the thead) as the keys, and turns every following row into an object. Cell text is flattened, so links and formatting inside a cell reduce to their visible text, and whitespace is normalised.

Numbers and booleans in cells are typed so that "224004" becomes a number and "true" a boolean; identifiers with leading zeros should be checked afterwards. The output is pretty-printed with the indent you choose.

The keys are the part that needs a look before you build on the result. They are taken from the header cell text with whitespace collapsed, so a column headed "Total (EUR)" becomes a property called Total (EUR), brackets, space and all, which is valid JSON but cannot be reached with dot notation and is awkward in every language. Rename those keys before you write code against them. Duplicate header text is the other thing to check, because two columns sharing a label collapse into one property and the rightmost value wins silently, which is easy to miss on a wide table until a column appears to have vanished.

It is the fastest route from a table on a documentation page, a reference site or a wiki to data you can actually query. Pair it with JSON to CSV if a spreadsheet is the final destination, edit the result in the JSON Formatter, or take the CSV route directly with HTML Table to CSV.

How to use

  1. Paste the table HTML on the left.
  2. Copy the JSON from the right.
  3. Adjust any typed values that should have stayed strings.

Common questions

Which row is used for keys?
The first row, whether it is inside a thead or not.
What if header cells are empty?
Empty headers are named column1, column2 and so on by position.
Does it work with tables from Wikipedia?
Usually, yes. Tables with rowspan or nested tables may need cleanup afterwards.