Skip to main content
Glama
JSON CSV Markdown Table Converter and Validator

JSON CSV Markdown Table Converter and Validator

by chunyunglo
README.md
# JSON CSV Markdown Table Converter and Validator

One focused tool for moving tabular data between the three formats people paste into tickets, spreadsheets, docs and LLM prompts:

- **JSON to CSV**: nested objects and arrays are flattened into dot-notation columns (`user.name`, `tags.0`).
- **CSV to JSON**: an array of objects keyed by the header row.
- **JSON or CSV to Markdown table**: a GitHub-flavoured table, with pipes escaped and line breaks turned into `<br>`.
- **Validate**: checks JSON syntax (with line and column) or CSV structure (ragged rows, duplicate headers, broken quotes). Invalid data is reported, and the run does not fail.

It also runs as an MCP server, so AI agents can call it as a tool.

## Input example

```json
{
  "data": "[{\"name\": \"Alice\", \"age\": 30, \"address\": {\"city\": \"Paris\"}}, {\"name\": \"Bob\", \"age\": 25}]",
  "inputFormat": "auto",
  "outputFormat": "csv",
  "delimiter": ",",
  "flattenNested": true
}
```

| Field | Meaning |
|---|---|
| `data` | JSON or CSV text (required) |
| `inputFormat` | `auto` (default), `json`, `csv` |
| `outputFormat` | `csv` (default), `json`, `markdown`, `validate` |
| `delimiter` | `,` (default), `;`, `tab`, `\|`. Used for reading and writing CSV |
| `flattenNested` | `true` (default) flattens nested JSON; `false` keeps nested values as JSON text |

## Output example

Each run produces one dataset item:

```json
{
  "inputFormat": "json",
  "outputFormat": "csv",
  "valid": true,
  "rowCount": 2,
  "columns": ["name", "age", "address.city"],
  "error": "",
  "output": "name,age,address.city\nAlice,30,Paris\nBob,25,"
}
```

Validation of broken CSV (`outputFormat: validate`):

```json
{ "valid": false, "rowCount": 2, "error": "line 3 has 1 fields, expected 2", "output": "" }
```

JSON errors read like `Invalid JSON: <parser message> at line L column C`. The exact parser message comes from Python's built-in `json` module and can differ slightly between Python versions.

## Pricing

US$0.0015 per conversion or validation (one event per run), plus standard Apify platform usage.

## Limits

- Up to 5,000,000 characters of input per run.
- CSV values are kept as strings. There is no type guessing, so `"30"` stays `"30"` in JSON output.
- JSON input must be an array of objects, a single object, or an array of plain values (these go into a `value` column).
- If a flattened key collides with a literal key (for example `"a.b"` and `{"a": {"b": ...}}`), the later value wins.
- Validation reports up to 20 row problems.
- When converting, invalid input fails the run with a clear message. Use `validate` to inspect the problems instead.

## Credits

Markdown tables are rendered with [python-tabulate](https://github.com/astanin/python-tabulate) by Sergey Astanin, MIT License. JSON and CSV handling uses the Python standard library.


---
**Hosted version:** [Apify Store](https://apify.com/chun_yung_lo/json-csv-markdown-converter) · **Docs:** [https://chunyunglo.github.io/afw-tools/json-csv-markdown-converter/](https://chunyunglo.github.io/afw-tools/json-csv-markdown-converter/)