HTML Table to JSON
Extract structured data from HTML table strings and convert them into clean JSON arrays for easy data migration and scraping.
// JSON data will appear here...
About the HTML Table to JSON
Paste the HTML of a table and get its rows as a JSON array, where each object’s keys come from the table’s header cells.
Everything you enter is processed in your browser; nothing is uploaded or stored.
How to use it
- Paste HTML containing a <table> (with <th> header cells).
- Read the JSON in the JSON Data panel.
- Copy it into your code, API mock or spreadsheet import.
How rows become JSON objects
The HTML is parsed by the browser, the first table is located, and the text of each <th> becomes a key. Every body row then becomes one object, pairing each cell’s text with the header in the same column.
Values are taken as text. Headers that are empty are named “unnamed”, so give every column a header for clean keys.
Example
A table with headers Product and Price and rows Laptop / 55000 and Mouse / 499 becomes [{"Product":"Laptop","Price":"55000"},{"Product":"Mouse","Price":"499"}].
Tips
- Copy a table from a web page with your browser’s “Inspect element”, then copy its outer HTML.
- Convert numeric strings to numbers in your code if you need to calculate with them.
Frequently asked questions
What if my table has no <th> cells?
Add a header row with <th> cells first; the headers become the JSON keys.
Can it handle several tables?
It converts the first table in the pasted HTML.
Can I go from JSON to an HTML table?
Yes, with the JSON to HTML Table converter.