1xA2ZOne Data. Any Format.
Live syncLocal-first · no data upload

Convert JSON to HTML

Paste a JSON array into the Quick paste box. The tool flattens it into a table and writes a table element with thead, th and td. It handles tabular data only and does not keep nested structure.

Runs entirely in your browser. Your data is never uploaded. Tiếng Việt

01

Spreadsheet

SheetsExcelCSVTSV
✦ Quick pasteSheets / Excel, CSV, TSV, Markdown, JSON, HTML, LaTeX, wiki…
0 rows · 0 columnsSelected cell: A1
02

Live Output

Markdowntwo-way
SyncedEdit directly; the table on the left updates itself
0 characters
Every change is processed right in your browserReady · LocalUTF-8 · by xuanhieu.org

When you need to convert JSON to HTML

You need JSON to HTML when you want API data on a static page, in an email or in an article without writing a loop. JSON can nest several levels deep, while an HTML table has only rows and columns. With Flatten nested objects (a.b.c) on, nested objects become columns named a.b.c and arrays become a.0, a.1, each as its own cell. You end up with a wider table than the source JSON suggests.

How to do it

  1. Paste the JSON into the Quick paste box and press Load into table ↵, or use Import file with a .json file. This page already has flattening on.
  2. Look at the grid: column names are key paths such as customer.name. Rename headers to readable labels, for example Customer name, right in the grid.
  3. Open the HTML tab and ⚙ Options. Enter a class for the table if your page uses a CSS framework, and choose whether to use thead.
  4. Press Copy result and paste into your page source, or Download file for an .html file.

A real example

The header row keeps the a.b.c key paths from the JSON, and the array cells order.items.0, order.items.1, order.items.2 sit side by side. Order A2 has one item, so its last two cells are empty. The table carries class="table".

Input · JSON

[
  {
    "id": "A1",
    "customer": {
      "name": "Anna Reed",
      "city": "London"
    },
    "order": {
      "total": 450,
      "items": [
        "book",
        "pen"
      ]
    }
  },
  {
    "id": "A2",
    "customer": {
      "name": "Ben Cole",
      "city": "Leeds"
    },
    "order": {
      "total": 1250,
      "items": [
        "backpack"
      ]
    }
  },
  {
    "id": "A3",
    "customer": {
      "name": "Cara Lin",
      "city": "Bristol"
    },
    "order": {
      "total": 299.5,
      "items": [
        "notebook",
        "pen",
        "ruler"
      ]
    }
  }
]

Result · HTML

<table class="table">
  <thead><tr><th>id</th><th>customer.name</th><th>customer.city</th><th>order.total</th><th>order.items.0</th><th>order.items.1</th><th>order.items.2</th></tr></thead>
  <tbody>
    <tr><td>A1</td><td>Anna Reed</td><td>London</td><td>450</td><td>book</td><td>pen</td><td></td></tr>
    <tr><td>A2</td><td>Ben Cole</td><td>Leeds</td><td>1250</td><td>backpack</td><td></td><td></td></tr>
    <tr><td>A3</td><td>Cara Lin</td><td>Bristol</td><td>299.5</td><td>notebook</td><td>pen</td><td>ruler</td></tr>
  </tbody>
</table>

Options worth changing

Flatten nested objects (a.b.c)
Turn it on when the JSON has objects or arrays inside records. Off, the nested part is placed in one cell as JSON text, which reads badly on a page.
<table> class
Enter a Bootstrap or Tailwind class such as table table-striped. Only letters, digits, hyphens and underscores are kept.
Use <thead> and <th>
On, the first row is a proper header, which helps screen readers. Off, every row is made of td cells.
Minify
Use it when embedding the HTML in a code string or an email template. Leave it off when you want to read and edit it.

Common problems

Limits

Frequently asked questions

Does nested JSON turn into nested tables?

No. It is flattened into one table with a.b.c columns. There are no sub-tables inside cells.

Can I add a Bootstrap class?

Yes. Type a class such as table table-striped into <table> class.

I want to paste into Word or Gmail instead.

Use the Rich text tab instead of HTML: it gives a formatted table to paste directly. The HTML tab is for source code.

Can I read HTML back into JSON?

Yes. Paste a table copied from a browser, paste HTML that starts with <table, or use Import file with an .html file. The first table is read, text only, and colours are ignored. See the HTML to JSON page.

Is my data sent anywhere?

No. Everything runs in your browser.

Related conversions

1xA2Z · Guide

Table statistics