CSV to JSON
Parse CSV text into a JSON array of objects or arrays.
/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
{
"data": [
{"name": "Alice", "age": "30", "city": "London"},
{"name": "Bob", "age": "25", "city": "Paris"}
],
"rows": 2,
"columns": 3,
"headers": ["name", "age", "city"]
}
Description
How to Use
1. Send a POST request with your CSV content in the `csv` field, or point to a public URL using `url`.
2. Set `has_header` to `true` (default) if the first row contains column names, or `false` to get arrays of values.
3. Optionally set `delimiter` to override auto-detection, and `skip_rows` to skip metadata lines.
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
- Data pipeline ingestion — Convert CSV exports from databases or spreadsheets into JSON for downstream APIs
- ETL preprocessing — Parse CSV files before loading into document stores or data lakes
- Spreadsheet migration — Transform tabular exports into structured JSON for web applications
- Log parsing — Convert CSV-formatted log files into queryable JSON objects
Frequently Asked Questions
What delimiters are auto-detected?
Are values type-cast?
Is there a size limit?
Start using CSV to JSON now
Get your free API key and make your first request in under a minute.