🧩

CSV to JSON

Parse CSV text into a JSON array of objects or arrays.

POST 1 credit /v1/convert/csv-to-json
curl -X POST "https://convert.toolkitapi.io/v1/convert/csv-to-json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"csv": "name,age,city\nAlice,30,London\nBob,25,Paris", "has_header": true}'
import httpx

resp = httpx.post(
    "https://convert.toolkitapi.io/v1/convert/csv-to-json",
    json={"csv": "name,age,city\nAlice,30,London\nBob,25,Paris", "has_header": true},
)
print(resp.json())
const resp = await fetch("https://convert.toolkitapi.io/v1/convert/csv-to-json", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"csv": "name,age,city\nAlice,30,London\nBob,25,Paris", "has_header": true}),
});
const data = await resp.json();
console.log(data);
# See curl example
Response 200 OK
{
  "data": [
    {"name": "Alice", "age": "30", "city": "London"},
    {"name": "Bob", "age": "25", "city": "Paris"}
  ],
  "rows": 2,
  "columns": 3,
  "headers": ["name", "age", "city"]
}

Description

Parse CSV text into a JSON array of objects or arrays.

How to Use

1

1. Send a POST request with your CSV content in the `csv` field, or point to a public URL using `url`.

2

2. Set `has_header` to `true` (default) if the first row contains column names, or `false` to get arrays of values.

3

3. Optionally set `delimiter` to override auto-detection, and `skip_rows` to skip metadata lines.

4

4. The response returns the parsed data as a JSON array with row/column counts and detected headers.

About This Tool

CSV to JSON converts a CSV string into a structured JSON array. When the CSV has a header row, each row becomes a JSON object keyed by the column names. Without headers, each row becomes a plain array of values.

The parser auto-detects the delimiter if you don't specify one (comma, tab, semicolon, and pipe are supported). You can also skip leading rows — useful for files with metadata lines before the actual data.

Why Use This Tool

Frequently Asked Questions

What delimiters are auto-detected?
The parser detects commas, tabs, semicolons, and pipes. If your file uses an unusual delimiter, pass it explicitly in the `delimiter` parameter.
Are values type-cast?
No — all values are returned as strings. Apply type conversion in your application if you need numbers or booleans.
Is there a size limit?
Yes. Input is checked against a server-side size limit to prevent timeouts. For very large files, use the file-based endpoint or the async jobs API.

Start using CSV to JSON now

Get your free API key and make your first request in under a minute.