Convert CSV to JSON
Paste CSV with a header row and get one record per row, named after the headers: in Ada, "Compiler, pioneer", true the quoted comma stays inside the same value. A row with the wrong number of columns is reported by its row number. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Every data row must contain exactly as many columns as the header. If one row is shorter or longer, conversion stops with a precise error instead of returning shifted or incomplete data.
Prepare CSV text with a reliable header row
Start with a header row that gives every column a nonempty, unique name. Values remain strings because CSV itself does not carry a dependable type system: a value that looks like a number might be an account code with meaningful leading zeroes, while a date can be ambiguous across regions. The converter accepts both Unix and Windows line endings and removes a leading byte order mark when spreadsheet software includes one.
Standard CSV quoting is supported. Wrap a value in double quotation marks when it contains a comma or a line break, and represent a literal quotation mark by doubling it. Spaces are preserved rather than silently trimmed, because whitespace may be significant in identifiers, labels, or imported content.
Understand strict column-count validation
The conversion is intentionally strict about structure. After parsing the header, it counts its columns and requires every following record to have the same count. A missing trailing value must still be represented by an empty final field, including the comma that introduces it.
Likewise, an unexpected extra comma creates another column unless it appears inside a correctly quoted field. When a record does not match, the operation reports its one-based CSV row number, the number of columns found, and the number expected. This behavior prevents a common and dangerous failure mode in permissive converters: values slide under the wrong headings, or missing fields disappear without notice.
Empty values are allowed and become empty strings; inconsistent records are not. The parser also rejects an unfinished quoted value, a quotation mark appearing midway through an unquoted field, and nonseparator characters placed after a closing quote. These checks make malformed exports visible at the boundary, where they are easier to repair than after downstream code has stored or transformed the wrong properties.
What you can do with it
Validate an export pipeline
Reject generated CSV as soon as one record has fewer or more fields than the declared header.
FAQ
Can fields contain commas or line breaks?
Yes. Enclose the field in double quotation marks. A literal quotation mark inside a quoted field is written twice.
What happens when a row has the wrong number of columns?
The conversion fails with an invalid-input error that identifies the row and reports both the actual and expected column counts.
Are empty cells supported?
Yes. An empty cell becomes an empty string, provided the row still contains the correct number of columns.
Why are numbers and dates kept as text?
Because CSV carries no reliable types: a value that looks like a number may be an account code with meaningful leading zeros, and a date can read differently from one region to another. Your own application decides the types later.
Can I convert a file that uses semicolons instead of commas?
Not directly. The converter expects comma-separated text, so replace the other separator with commas first. Values that contain a comma must then be wrapped in double quotation marks.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/web/csv-to-json \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"name,role,active\nAda,Engineer,true\nGrace,Admiral,false"}'const res = await fetch("https://api.kit.forhosting.com/web/csv-to-json", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"text": "name,role,active\nAda,Engineer,true\nGrace,Admiral,false"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/web/csv-to-json",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"text": "name,role,active\nAda,Engineer,true\nGrace,Admiral,false"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/web/csv-to-json", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"text":"name,role,active\\nAda,Engineer,true\\nGrace,Admiral,false"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"text":"name,role,active\nAda,Engineer,true\nGrace,Admiral,false"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/web/csv-to-json", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"text": "name,role,active\nAda,Engineer,true\nGrace,Admiral,false"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "web.csv_to_json",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
timeout_sec | 30 |
max_crawl_pages | 25 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Convert CSV to JSON when you need a predictable object for every data row, without quietly accepting malformed input. Paste CSV text with a header row and this tool uses each header as a JSON property name. It understands quoted commas, escaped quotation marks, Windows or Unix line endings, and line breaks inside quoted values.
Prepare CSV text with a reliable header row
Those names become the property keys in every JSON object, so a header such as name,email,status produces objects with exactly those three keys. Keeping the source text intact avoids destructive guesses and lets the receiving application apply its own schema. A header-only document is valid and returns an empty JSON array.
Use the JSON output safely in applications
Because the algorithm is deterministic, identical CSV text always produces identical output, with no network request, random value, or timestamp involved. Treat the result as a faithful structural conversion rather than a data-cleaning pass. The tool does not infer numbers, booleans, dates, or null values, and it does not rename headings or repair broken rows. If the source uses another delimiter, normalize it to comma-separated text before conversion. The result is a JSON array in original row order, with one plain object for each data record. You can send that array to an API, inspect it in a test, save it as a JSON document, or pass it into a validation step that applies domain-specific types. For automation, the API price is $0.002 per request; interactive conversion can run in the browser. That separation is useful: conversion answers which value belongs to which header, while a later schema validator decides what each value means.
Integration use cases
Prepare an API payload
Turn a spreadsheet export into an array of consistently keyed objects before applying an API-specific schema.
Create deterministic test fixtures
Convert compact CSV samples into stable JSON arrays that are easy to compare in automated tests.
Technical questions
Are numeric and boolean values converted to native JSON types?
No. Every CSV cell remains a string so codes, leading zeroes, and ambiguous values are not changed by guesswork.
What does API conversion cost?
The API costs $0.002 per request. The same deterministic conversion can run interactively in the browser.