How to use the json to markdown table converter
- Paste a JSON array of objects into the text area.
- The json to markdown table converter automatically parses the JSON and collects every unique key across all objects to build the table headers.
- Nested objects and arrays are serialized back to compact JSON strings, while
null, booleans and numbers are preserved as-is. - Copy the generated Markdown table and paste it into your README, wiki or documentation file.
How the conversion works
The converter expects a JSON array where each element is an object. It iterates through every object in order, collecting keys as they first appear. This guarantees a stable column order even when objects have different shapes.
For example, given [{"name":"Alice","age":30},{"age":25,"city":"NYC"}], the keys are discovered in the order: name, age, city. The resulting json to markdown table output has three columns, and missing values are left as empty cells:
| name | age | city |
|---|---|---|
| Alice | 30 | |
| 25 | NYC |
Values that are objects or arrays are converted to compact JSON strings using JSON.stringify without extra whitespace. Strings containing the pipe character (|) are escaped with a backslash so the Markdown parser does not treat them as cell boundaries.
Handling edge cases
Real-world JSON data is rarely uniform. A reliable json to markdown table tool must account for several common edge cases that break naive converters:
- Mismatched keys: If one object has a key that another lacks, the column is still created and the missing cell is left empty.
- Nested structures: Objects and arrays inside the data are stringified. A value like
{"role":"admin"}becomes the literal string{"role":"admin"}in the cell. - Null and booleans:
nullrenders as the word "null", whiletrueandfalserender exactly as written. This avoids ambiguity with empty strings. - Pipe characters: Any
|inside a string value is escaped to\|to prevent breaking the Markdown table syntax. - Unicode: Emojis, accented characters and non-Latin scripts pass through unchanged because Markdown tables support UTF-8 natively.
Common use cases
Converting JSON to a Markdown table is useful whenever you need to present structured data in documentation. Common scenarios include:
- Generating API response examples for README files on GitHub or GitLab.
- Creating comparison tables from configuration files or feature flags.
- Documenting database query results exported as JSON arrays.
- Building static site content where data originates from a headless CMS returning JSON.
If you need other formats instead of Markdown, related tools can convert JSON to HTML tables or XML. For generating code models from JSON, see the converters for Go structs, Python classes, Java classes, C# classes or Kotlin data classes.
Markdown table syntax reference
A standard Markdown table consists of a header row, a separator row and zero or more data rows. Each row starts and ends with a pipe character, though many parsers tolerate omitting the outer pipes.
| Syntax element | Example | Description |
|---|---|---|
| Header row | | Name | Age | | Defines the column titles. |
| Separator | | --- | --- | | Dashes separate the header from the body. Colons control alignment. |
| Data row | | Alice | 30 | | One row per record. Cells may be empty. |
| Alignment | | :--- | ---: | | Left colon aligns left, right colon aligns right, both center. |
This converter uses the default left-aligned separator (---) for all columns to keep the output simple and compatible with every Markdown flavor, including GitHub Flavored Markdown (GFM) and CommonMark extensions.
Worked examples
| Example | Input | Result |
|---|---|---|
| Simple array | JSON input: [{"name":"Alice","age":30},{"name":"Bob","age":25}] | | name | age | / | --- | --- | / | Alice | 30 | / | Bob | 25 | |
| Nested objects and nulls | JSON input: [{"id":1,"user":{"name":"Eve","active":true},"tags":["admin","user"]},{"id":2,"user":null,"tags":[]}] | | id | user | tags | / | --- | --- | --- | / | 1 | {"name":"Eve","active":true} | ["admin","user"] | / | 2 | null | [] | |
| Unicode and pipes | JSON input: [{"emoji":"🚀","expr":"a || b"},{"emoji":"✅","expr":"x && y"}] | | emoji | expr | / | --- | --- | / | 🚀 | a \|\| b | / | ✅ | x && y | |
FAQ
What JSON structure does this json to markdown table tool accept?
It accepts a JSON array of objects, such as [{"key": "value"}]. If you provide a single object, wrap it in square brackets first. Primitive arrays like [1, 2, 3] are not supported because tables require named columns.
How are nested objects and arrays handled?
Nested objects and arrays are serialized into compact JSON strings. For example, {"a": [1, 2]} becomes the literal text {"a":[1,2]} inside the table cell.
Will pipe characters in my data break the table?
No. The converter automatically escapes any pipe character (|) found inside string values by prefixing it with a backslash, ensuring the Markdown table remains valid.
Is my JSON data sent to a server?
No. The parsing and formatting happen entirely in your browser using JavaScript. Nothing is uploaded or transmitted over the network.
Can I convert JSON to SQL or XML instead?
Yes. Use the dedicated JSON to SQL or JSON to XML converters for those formats.
Why are some cells empty in the output?
When objects in the array have different keys, the converter creates a column for every unique key. If a particular object lacks a key, its corresponding cell is left empty.