Skip to content

JSON to Markdown Table

Convert a JSON array of objects to a Markdown table. Keys become columns, objects become rows.

This tool converts an array of JSON objects to a Markdown table in your browser; nothing leaves your machine. For the underlying Markdown table format, see CSV to Markdown table; for the JSON parsing, see JSON formatter.

The clean case

[
  {"name": "Alice", "age": 30, "city": "NYC"},
  {"name": "Bob",   "age": 25, "city": "Boston"}
]

Becomes:

| name  | age | city   |
| ----- | --- | ------ |
| Alice | 30  | NYC    |
| Bob   | 25  | Boston |

The header is the union of keys across all objects. Each row is one object’s values, in header order. Missing keys produce empty cells.

Heterogeneous keys

[
  {"name": "Alice", "age": 30},
  {"name": "Bob",   "city": "Boston"}
]

→

| name  | age | city   |
| ----- | --- | ------ |
| Alice | 30  |        |
| Bob   |     | Boston |

The union of keys is name, age, city. Each row leaves missing fields empty.

For predictable column ordering, the tool walks the input and adds keys to the header in the order they first appear.

Type rendering

JSON values render to Markdown table cells:

JSONMarkdown cell
"string"string
4242
3.143.14
true / falsetrue / false
nullempty (no rendering)
{}{} or JSON-encoded
[][] or JSON-encoded

Strings are passed through with Markdown special characters escaped (see below).

Special characters in cells

Markdown tables have constraints:

  • Pipes (|) inside cells break the table parser. Escape as \|.
  • Newlines inside cells aren’t supported in standard Markdown tables. Replace with <br> or with a space.
  • HTML inside cells is rendered by GitHub-flavored Markdown but not by strict CommonMark. Be portable.

The tool above auto-escapes pipes and replaces newlines with <br>.

Nested objects

Markdown tables don’t support nesting. Two strategies for nested fields:

Flatten with dotted keys

[{"user": {"name": "Alice", "city": "NYC"}}]

→

| user.name | user.city |
| --------- | --------- |
| Alice     | NYC       |

Each nested key becomes a separate column. Headers can get long; tables can get wide.

JSON-encode the cell

| user                              |
| --------------------------------- |
| {"name":"Alice","city":"NYC"}     |

Compact but unreadable.

The tool above JSON-encodes nested objects and arrays into the cell (the second strategy); it doesn’t flatten them into dotted-key columns. If you want flattened columns, flatten the JSON first.

Arrays inside cells

[{"name": "Alice", "tags": ["vip", "active"]}]

→

| name  | tags          |
| ----- | ------------- |
| Alice | vip, active   |

Arrays of primitives are joined with , . Arrays of objects don’t flatten cleanly into a single cell — those need a different output strategy (denormalization to multiple rows or HTML/JSON encoding).

Padding for readability

Compact (renderer-friendly, hard to read):
|name|age|city|
|---|---|---|
|Alice|30|NYC|

Padded (renderer-friendly, easy to read):
| name  | age | city |
| ----- | --- | ---- |
| Alice | 30  | NYC  |

Both render identically in any compliant Markdown renderer. The padded form is much easier to edit by hand. The tool above produces the compact form.

When this isn’t the right tool

  • Single object (not an array). A Markdown table needs rows. Wrap a single object in an array, or use a key-value vertical table format.
  • Tables that need merged cells. Markdown doesn’t support colspan / rowspan. Use HTML or rethink the structure.
  • Very large datasets. Markdown tables don’t scroll, paginate, or filter. Use a JavaScript table component for interactivity.
  • Tabular data with rich content per cell. Markdown’s per-cell formatting is limited; for complex content (images, code blocks, multi-paragraph text), use HTML.

Common pitfalls

  • Forgetting the array wrapper. Single objects produce no table. The input must be an array.
  • Pipes inside string values. A literal | breaks the table without escaping. The tool above handles this; manual conversion needs care.
  • Newlines in string values. Standard Markdown tables don’t honor \n. Use <br>.
  • Numeric vs string values that look the same. "42" (string) and 42 (number) render identically in the table. The distinction is lost. If the consumer needs to know which it was, JSON is the wrong source format.
  • Inconsistent keys producing wide tables. A schema with 50 sometimes-present keys produces a 50-column table that’s barely usable. Filter to the common keys before generating, or use a different visualization.

For the reverse direction (Markdown → JSON), no standard tool exists; parsing Markdown tables is heuristic. For other JSON conversions, see JSON to CSV, JSON to TypeScript. For the underlying table syntax, CSV to Markdown table.