# Convert CSV to JSON from an AI agent

You have a complete CSV document and need an array of JSON objects keyed by its header row.

**Use `csv-to-json@1.0.0`.** It is free and needs no key or sign-up. Convert a complete CSV document into an array of string-valued objects.

## Why call a tool for this

Quoted fields and embedded commas are where hand conversion goes wrong. The tool parses the document and returns each row as an object.

## Call it over HTTP

```sh
curl -X POST https://computefirst.net/v1/tools/csv-to-json/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"csv":"name,city\nAda,London\n"}'
```

Response:

```json
{
  "result": [
    {
      "name": "Ada",
      "city": "London"
    }
  ]
}
```

## Call it over MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "csv-to-json",
  "version": "1.0.0",
  "input": {
    "csv": "name,city\nAda,London\n"
  }
}
```

## Check the result

All values come back as strings. Convert numbers and dates in a later step if your task needs them typed.

Full contract, limits and unsupported cases: [CSV to JSON](/tools/csv-to-json).

## Related tools

- [CSV row diff](/tools/csv-row-diff)
