Find your next tool

Browse tools or search by task

Explore JSONToonPro

JSON Tools

CSV to JSON Converter Online – Convert CSV to JSON

Convert CSV to a JSON array online with quoted-field and custom-delimiter support. Preview structured output and process files entirely in your browser.

Runs locally in your browser. Nothing you paste is uploaded.

CSV to JSON workspace
Delimiter
4 × 8
Input· CSV
287 chars5 lines
Output· JSON
753 chars42 lines

How to Convert CSV to JSON

Paste CSV, choose the matching delimiter and decide whether the first row contains headers. Preview the JSON array before copying it. Correct quoting is essential when fields contain delimiter characters or line breaks.

CSV Headers and JSON Object Keys

Header cells become object keys. Use distinct headers to avoid ambiguous mappings. Without a header row, generated column names let the converter preserve positions. Review unexpected blank or duplicate headers in the source.

Quoted Fields, Delimiters and Empty Values

Quoted delimiters belong to a field rather than splitting it. A quote inside a quoted field is written twice. Empty cells are represented as null; inspect missing trailing cells and rows with inconsistent field counts.

CSV to JSON Examples

A header id,name followed by 1,Ada produces one record with id and name fields. Numeric and boolean fields are coerced when recognized; leading-zero identifiers remain strings. Pipe-separated values use an array convention. Review inferred types before using the result.

Cleaning CSV Before Conversion

Check delimiter choice, line endings, extra header rows and repeated field names before conversion. Preserve a copy of the original CSV so a cleanup step can be reversed. CSV is text, not an Excel workbook.

More examples and technical details

How the Header Row Becomes Object Keys

Converting CSV to JSON is mostly a mapping exercise. The first line of the file is read as a list of column names, and every following line becomes one object whose keys are those names and whose values are the fields in matching positions. An array of those objects is the output.

This is why the header row carries so much weight. It is the schema of the file, and any oddity in it propagates into every single record. Column names with spaces, trailing whitespace, or mixed casing all become awkward object keys, so it is worth trimming and normalising them before the conversion rather than fixing thousands of objects afterwards.

If the header uses dot notation, unflattening can rebuild nested structure: a column called address.city puts city inside an address object instead of creating a literal key with a full stop in it. That is what makes a JSON to CSV to JSON round trip come back to where it started.

Side by Side Example

A small inventory export, converted with type inference and unflattening turned on.

CSV input

sku,title,price,in_stock,supplier.name
AX-9,Desk lamp,24.50,true,Northlight
BX-2,"Chair, folding",89.00,false,Peak
CX-7,Rug,,true,Northlight

JSON output

[
{ "sku": "AX-9", "title": "Desk lamp",
"price": 24.5, "in_stock": true,
"supplier": { "name": "Northlight" } },
{ "sku": "BX-2", "title": "Chair, folding",
"price": 89, "in_stock": false,
"supplier": { "name": "Peak" } },
{ "sku": "CX-7", "title": "Rug",
"price": null, "in_stock": true,
"supplier": { "name": "Northlight" } }
]

Two details are worth noticing. The quoted title in row two keeps its comma and loses its quotes, because the quotes were transport syntax rather than content. And 24.50 became 24.5, because JSON numbers have no concept of trailing decimal places.

Type Inference and When to Skip It

Every value in a CSV file is text. Type inference is the step that decides which of those text values should become JSON numbers, booleans, or null.

Cell contentInferred asRisk
42NumberLow, unless it is a zero padded code
3.14NumberLow
007String if padding is preservedHigh, inference may strip to 7
true / falseBooleanLow, but TRUE and yes need explicit rules
(empty)null or empty stringAmbiguous, an empty string and a missing value are not the same thing
1e5Number 100000Product codes and batch ids get mangled
+441234String or numberLeading plus is dropped by many parsers

There is a real argument for leaving everything as strings. Identifiers, phone numbers, postcodes, account numbers, and version strings are all data that looks numeric but must never be arithmetic. If the JSON is going straight into a system that will validate and cast it anyway, strings in and strings out is the safest default. Turn inference on when the JSON is being consumed directly by application code that expects real numbers.

Quoted Fields, Delimiters, and Embedded Newlines

A correct CSV parser is a small state machine, not a call to split. It has to track whether it is currently inside a quoted field, because inside quotes the delimiter and the line break are ordinary characters.

One record spanning three physical lines

id,note
1,"First line
second line
third line"

That file has four physical lines but only two records. A doubled quote inside a quoted field means a literal quote character, so "He said ""no""" holds the value He said "no". Anything that splits on the newline before understanding quotes will produce three broken rows and no error message.

Header and Row Edge Cases

Edge caseWhat goes wrongSensible handling
Duplicate header namesThe later column silently overwrites the earlier oneSuffix duplicates as name, name_2, name_3
Empty header cellProduces an object key of empty stringFall back to column_1, column_2 by position
Ragged row, too few fieldsMissing keys, uneven objectsPad with null so every object has the same shape
Ragged row, too many fieldsExtra values have no keyCollect the surplus into an _extra array or reject the row
Blank line in the middleEmits an object of all nullsSkip empty lines by default
Comment lines starting with #Parsed as dataEnable a comment prefix option before parsing
CRLF versus LF endingsTrailing carriage return glued onto the last fieldNormalise line endings before splitting

The Byte Order Mark Bug

This one deserves its own section because it wastes more time than anything else on the list. Files exported from Excel on Windows often begin with a UTF-8 byte order mark, three invisible bytes (EF BB BF) before the first character. Most editors hide it. Your parser does not.

What you see and what you get

You see: id,name,email
You get: { "\ufeffid": 1, "name": ... }
 
row.id is undefined
row["\ufeffid"] is 1

The symptom is unmistakable once you know it: only the very first column comes back undefined and every other column is fine. The fix is to strip a leading U+FEFF from the file before parsing, or to decode the file with an encoding that consumes the mark. If you are producing files for Excel rather than consuming them, the reverse applies, since Excel needs that mark to recognise UTF-8 at all.

Once your CSV is clean JSON, the next step is usually a schema or a type. Browse the full converter collection for JSON to TypeScript to generate interfaces from the result, JSON Schema for validation rules, and JSON to CSV when you need to send the data back the other way.

Frequently asked questions

How do I convert CSV to JSON?

Paste CSV, choose its delimiter and header behavior, then copy the JSON array.

Does the converter support quoted commas?

Yes. Properly quoted commas are treated as part of the field.

Can I use a custom delimiter?

Choose one of the available delimiter settings, such as comma, semicolon or tab, to match the file.

How are empty cells represented?

Empty cells become null; review irregular rows before using the result.

Is CSV data uploaded?

No. Input is processed in this browser tab and is not uploaded by the tool. Copy and download are actions you control; ordinary page analytics do not receive tool input.