# CSV, JSON and XML with MarkItDown

> How MarkItDown 0.1.9 converts CSV to a Markdown table, why TSV, JSON, YAML and generic XML are printed back unchanged, and what happens with other encodings.

Source: https://markitdown.dev/formats/csv-json-xml/ · Updated 2026-11-16·Upstream source ↗

CSV is the one data format MarkItDown really converts: it becomes a Markdown table. TSV, JSON, YAML, TOML and ordinary XML are accepted but printed back unchanged, with exit code 0, so nothing tells you they were not converted. RSS and Atom feeds are the exception among XML files.

> **Short answer**
>
> `markitdown data.csv -o data.md` gives a Markdown table. **Do not expect any conversion from `.json`, `.tsv`, `.yaml` or generic `.xml`: you get the original text.** Non-UTF-8 CSV files need the encoding hint ([CLI page](https://markitdown.dev/cli/)).

Tested with markitdown 0.1.9 · Python 3.13 · markitdown 0.1.9 · 15 files on Ubuntu, Windows and macOS runners (T05) · 2026-11-16 · evidence: [format-matrix.csv](https://markitdown.dev/data/format-matrix.csv), [echoed-types.csv](https://markitdown.dev/data/echoed-types.csv), [synthetic\_data.csv.md](https://markitdown.dev/evidence/T05/outputs/synthetic_data.csv.md)

## What each file gave

Fifteen data files, one run each, and our grade (A is best)
| File | Type | Output characters | Grade | Notes |
| --- | --- | --- | --- | --- |
| `synthetic/csv-gbk.csv` | `.csv` | 24 | D | A 24-byte GBK file is detected as UTF-16 and comes out as mojibake in a single cell; -c gbk fixes it. |
| `synthetic/csv-quoted-newlines.csv` | `.csv` | 82 | B | Quoted line break inside a cell is flattened to a space; table intact. |
| `synthetic/csv-semicolon.csv` | `.csv` | 73 | C | Semicolon-separated values are not split: one column containing 'id;name;city'. |
| `synthetic/csv-utf16.csv` | `.csv` | 101 | A | Table; UTF-16 detected. |
| `synthetic/csv-utf8-bom.csv` | `.csv` | 101 | A | Table; BOM handled. |
| `synthetic/data-cp1252.csv` | `.csv` | 79 | C | Table produced but charset guessed wrong: 'café déjà vu' became 'cafķ dķjÓ vu'. Fixed with -c cp1252. |
| `synthetic/data-shiftjis.csv` | `.csv` | 52 | A | Shift-JIS detected correctly; Japanese text intact. |
| `synthetic/data.csv` | `.csv` | 146 | A | Markdown table; pipe inside a cell is escaped (\\|). |
| `synthetic/csv-tab.tsv` | `.tsv` | 50 | D | Tab-separated text is echoed unchanged, not converted to a table (.tsv is plain text). |
| `synthetic/data.json` | `.json` | 117 | D | Passed through unchanged (pretty-printed JSON stays JSON; no fenced code block). |
| `synthetic/data.xml` | `.xml` | 102 | D | Passed through unchanged as plain text. |
| `synthetic/feed-atom.xml` | `.xml` | 37 | A | Atom feed: title H1, entries H2, summary text. |
| `synthetic/feed.xml` | `.xml` | 108 | A | RSS converter: feed title H1, items H2, date line, HTML description converted. |
| `synthetic/config.yaml` | `.yaml` | 35 | D | Passed through unchanged as plain text (no YAML handling). |
| `synthetic/config.toml` | `.toml` | 35 | D | Passed through unchanged as plain text. |

*Fifteen data files, one run each, and our grade (A is best) Source: Test T05 · markitdown 0.1.9 · format-matrix.csv · Download CSV*

## CSV becomes a table

````markdown
| station | rainfall_mm | notes |
| --- | --- | --- |
| Alpha | 412.5 | Battery, low |
| Bravo | 388.0 | OK \| stable |
| Charlie | 451.3 | café |
````

*synthetic_data.csv.md · 147 bytes*

The first row is the header. A pipe inside a cell is escaped (`\|`), and a line break inside a quoted cell became a space:

````markdown
| id | note |
| --- | --- |
| 1 | line one line two |
| 2 | has "quotes", commas |
````

*synthetic_csv-quoted-newlines.csv.md · 82 bytes*

UTF-8 (with or without a byte-order mark) and UTF-16 files came out correctly (grade A), and so did a Shift-JIS file.

### Delimiters other than a comma

A semicolon-separated file stayed in one column, because only commas split cells:

````markdown
| id;name;city |
| --- |
| 1;Zoë;Zürich |
| 2;Łukasz;Kraków |
| 3;田中;東京 |
````

*synthetic_csv-semicolon.csv.md · 85 bytes*

### Other encodings

A GBK file and a Windows-1252 file with accented letters came out wrong: the GBK file was garbled completely, and the Windows-1252 file had wrong characters.

````markdown
| station | notes |
| --- | --- |
| Alpha | cafķ dķjÓ vu |
| Bravo | na’ve Ć5 |
````

*synthetic_data-cp1252.csv.md · 85 bytes*

Telling MarkItDown the encoding fixed both in our tests (`-c gbk` and `-c cp1252` on the command line; see [CLI page](https://markitdown.dev/cli/)), and see [encoding errors](https://markitdown.dev/errors/unicodeencodeerror/).

## JSON, TSV, YAML and generic XML are echoed

What the plain-text converter does with a JSON file
| Type | What you get |
| --- | --- |
| `.json` | exit code 0; the file's own text is printed back unchanged |

*What the plain-text converter does with a JSON file Source: Test T05 · echoed-types.csv · Download CSV*

````markdown
{
  "station": "Alpha",
  "readings": [
    {
      "date": "2026-03-01",
      "mm": 412.5
    }
  ],
  "ok": true
}
````

*synthetic_data.json.md · 117 bytes*

The same is true of `.tsv`, `.yaml`, `.toml` and a generic `.xml` file:

````markdown
<?xml version="1.0"?>
<stations><station id="1"><name>Alpha</name><mm>412.5</mm></station></stations>
````

*synthetic_data.xml.md · 102 bytes*

If you want a Markdown table from TSV or JSON, convert it yourself first (for example to CSV) and then run MarkItDown. We did not test a particular recipe.

## RSS and Atom feeds

An RSS or Atom file becomes a title plus one section per entry ([formats page](https://markitdown.dev/formats/)).

## Related

- [Supported formats](https://markitdown.dev/formats/): Every file type, graded.
- [Excel (XLSX, XLS)](https://markitdown.dev/formats/excel/): Excel workbooks.
- [UnicodeEncodeError and garbled output on Windows](https://markitdown.dev/errors/unicodeencodeerror/): Character-encoding errors.
- [HTML, URLs, Wikipedia, RSS](https://markitdown.dev/formats/html/): HTML and web pages.

---
Independent guide to the open-source MarkItDown library. Not affiliated with or endorsed by Microsoft. Official source: https://github.com/microsoft/markitdown
