JSON to HTML Table
Convert JSON arrays to styled HTML table markup. Optional inline CSS included.
What is JSON to HTML Table Conversion?
Converting a JSON array to an HTML table turns structured data into a visual table that can be embedded directly in web pages, emails, or CMS content. Each JSON object in the array becomes a table row, and the object keys become column headers — no template code required.
This is useful for building data dashboards, generating reports that include tabular data, inserting dynamic content into email templates, creating documentation pages from API responses, or producing quick visual summaries of database exports.
JSON to HTML Table Example
[
{ "name": "Alice", "score": 95, "grade": "A" },
{ "name": "Bob", "score": 82, "grade": "B" }
]Generates:
<style>
table { border-collapse: collapse; width: 100%; font-family: sans-serif; }
th, td { border: 1px solid #ddd; padding: 8px 12px; text-align: left; }
th { background: #f5f5f5; font-weight: 600; }
tr:nth-child(even) { background: #fafafa; }
</style>
<table>
<thead>
<tr><th>name</th><th>score</th><th>grade</th></tr>
</thead>
<tbody>
<tr><td>Alice</td><td>95</td><td>A</td></tr>
<tr><td>Bob</td><td>82</td><td>B</td></tr>
</tbody>
</table>XSS Safety
All cell values are HTML-escaped: &, <, >, and " are replaced with their HTML entity equivalents. This prevents XSS when rendering untrusted data.
Common Uses
- ▸Email reports and digests — Turn a JSON export into a table for a transactional or scheduled report email, where a real <table> is still the most reliable layout tool.
- ▸CMS and documentation pages — Paste a data table directly into a CMS's HTML block or a static site's markdown-with-HTML content.
- ▸Quick data dashboards — Render an API response as a readable table for an internal tool without building a full frontend component for it.
- ▸Turning an API response into documentation — Show example response data as a formatted table in API docs instead of a raw JSON block.
Making the Table Responsive
A generated table with many columns can overflow a narrow viewport. The standard fix is wrapping it in a scrollable container rather than trying to shrink every column: <div style="overflow-x: auto">...table...</div>. This keeps the table's columns readable at their natural width and lets the wrapper scroll horizontally on small screens, instead of squeezing text until it wraps awkwardly or becomes illegible.