# CSV to JSON

`csv-to-json` · version 1.0.0 · CSV & tables · free, no key needed

Convert a complete CSV document into an array of string-valued objects.

**Use when you need to: csv to json · convert csv to json · parse csv rows.**

## Supported

- csv to json
- convert csv to json
- parse csv rows

## Not supported

- infer types
- stream rows
- read files
- fetch urls
- json to csv

## Behavior

- The first CSV record supplies object property names.
- Duplicate and empty header names are rejected.
- Every cell remains a string; numbers, booleans, nulls, and dates are not inferred.
- The whole CSV document is processed in one request and row order is retained.

## Input

- `csv` (string, required): max length 256000

## Output

- array of object: max items 5000

## Limits

- max input bytes: 256000
- max data rows: 5000
- max columns: 256
- max header name bytes: 256
- max output bytes: 1048576

## Example

Request input:

```json
{
  "csv": "name,city\nAda,London\n"
}
```

Response:

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

## How to call it

### 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"
  }
}
```

### HTTP (no key)

```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"}'
```

The machine-readable contract is at [/v1/tools/csv-to-json/versions/1.0.0](/v1/tools/csv-to-json/versions/1.0.0).

### CLI

```sh
node cli.mjs run csv-to-json 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [CSV transpose](/tools/csv-transpose): Transpose a CSV matrix including the header row, then re-validate headers.
- [CSV add row number](/tools/csv-add-row-number): Prepend a 1-based row_number column of canonical integer strings.
- [CSV anti join](/tools/csv-anti-join): Keep left CSV rows whose exact key tuples do not appear in the right document.
- [CSV concat](/tools/csv-concat): Concatenate CSV documents that share identical headers, preserving document and row order.
- [CSV dedupe](/tools/csv-dedupe): Remove duplicate CSV data rows while preserving the first occurrence.
- [CSV group count](/tools/csv-group-count): Count CSV rows by exact named-column tuples in first-seen order.
