Convert JSON to HTML Table Online
Render a JSON array as an HTML <table>, with the keys as <th> headers. The JSON is parsed in your browser and never uploaded.
Drop a CSV or Excel file here
CSV · XLSX · XLS · XLSM · XLSB
Ready to download as a binary file.
How to convert JSON to an HTML table
Three steps from rates.json to an HTML table.
1. Paste the JSON
Paste JSON or drop a .json file. Arrays, keyed objects and JSON Lines all work.
2. Check it in the grid
Check for values that contain markup. With Escape HTML ticked they show as text, which is the safe choice for data from an API.
3. Set the markup options
Keep or drop thead/tbody, escaping and minifying, add a class name, then copy the markup or download data.html.
Example: JSON in, HTML out
Exchange rates stored as a keyed object: each currency code points to an object of fields.
{
"EUR": { "name": "Euro", "rate": 0.92 },
"GBP": { "name": "Pound sterling", "rate": 0.79 }
}<table>
<thead>
<tr>
<th>key</th>
<th>name</th>
<th>rate</th>
</tr>
</thead>
<tbody>
<tr>
<td>EUR</td>
<td>Euro</td>
<td>0.92</td>
</tr>
<tr>
<td>GBP</td>
<td>Pound sterling</td>
<td>0.79</td>
</tr>
</tbody>
</table>A keyed object gets an extra first column named key, holding EUR and GBP. Values are escaped, so data from an API can't inject markup.
What changes between JSON and HTML
Escaping
&, <, >, " and ' are turned into entities, so cell text can never inject markup. Untick Escape HTML only if a column holds markup you want the browser to render.
Empty cells
Empty values become empty cells (<td></td>), so every row keeps all 3 columns.
Keyed object → key column
Each property name (EUR and GBP) becomes a row, in a first column called key, and the fields of the inner objects become the other columns.
When to convert JSON to HTML
- Showing API data on a static page or in an admin email without writing a template.
- Giving non-developers a readable HTML preview of a JSON export.
JSON to HTML in JavaScript
JSON needs no parser: JSON.parse gives you the data. Then every value is escaped into a <table>.
import { readFile } from 'node:fs/promises';
const data = JSON.parse(await readFile('rates.json', 'utf8'));
const toText = (v) => (v == null ? '' : typeof v === 'object' ? JSON.stringify(v) : String(v));
const fields = [...new Set(Object.values(data).flatMap((o) => Object.keys(o)))];
const header = ['key', ...fields];
const rows = Object.entries(data).map(([key, o]) => [key, ...fields.map((f) => toText(o[f]))]);
const esc = (v) => String(v ?? '').replace(/&/g, '&').replace(/</g, '<')
.replace(/>/g, '>').replace(/"/g, '"');
const tr = (cells, tag) => '<tr>' + cells.map((c) => `<${tag}>${esc(c)}</${tag}>`).join('') + '</tr>';
console.log(`<table>\n<thead>${tr(header, 'th')}</thead>\n<tbody>\n` +
rows.map((row) => tr(header.map((_, i) => row[i]), 'td')).join('\n') + '\n</tbody>\n</table>');TabularJS reads spreadsheet files, not JSON; JSON.parse is all JSON needs.
Frequently asked questions
Can I build the table in the browser at runtime instead?
Yes; the snippet above shows the few lines involved. Escape every value, as this page does, whenever the data comes from users or an API.
Where does the key column come from?
When the JSON is an object of objects, each property name becomes a row and is written into a first column called key. Rename that header in the grid, for example to code.
What if the objects have different keys?
Every key that appears in any object becomes a column. Objects without that key get an empty cell, which becomes an empty <td>.
What does Minify do?
It writes the whole table on one line without indentation, which is useful for HTML emails or when you embed the markup in a JavaScript string.
Does rates.json get uploaded when I convert it to HTML?
No. The JSON is parsed in your browser and never uploaded.