CSV to JSON

CSV to JSON — a free online tool.

Converting CSV to JSON

Paste CSV data with a header row, and this tool converts each subsequent row into a JSON object keyed by those headers, producing a clean JSON array - handling quoted fields and embedded commas correctly along the way. Useful for turning a spreadsheet export into a format ready for an API, a script, or a JSON-based database. Everything runs locally in your browser.

Why the first row has to be a header row

JSON objects need named keys, and the header row is what supplies those names - without it, the converter would have nothing to call each value except a numeric index, producing a far less useful result for anything meant to be read by a script or an API that expects named fields.

Why quoted fields need special handling

A field wrapped in double quotes can legitimately contain a comma, a line break, or even an escaped quote character of its own ("" inside quotes represents one literal quote) - a naive split-on-comma approach would break on any of these, which is why proper CSV parsing has to track whether it's currently inside a quoted field before deciding what a comma or line break actually means.

Why missing values become empty strings rather than being skipped

Keeping every header present as a key, even when a particular row has no value for it, keeps every object in the resulting array with a consistent, predictable shape - which matters for any script or API consuming the JSON that expects to find the same set of fields on every record, rather than having to check for missing keys case by case.

Veelgestelde vragen

Does this handle commas inside a field?

Yes - as long as the field is wrapped in double quotes in the CSV (the standard CSV convention), commas, line breaks, and quote characters inside it are handled correctly.

What if a row has fewer values than there are headers?

Missing values for that row are filled in as empty strings in the resulting JSON object, so every record still has every header as a key.

Why does the first row need to be headers specifically?

JSON objects need named keys, and the header row supplies those names - without it, there would be nothing to call each value except a numeric position.

Can I paste data copied directly from a spreadsheet program?

Yes, as long as it's in standard comma-separated format - quoted fields with embedded commas or line breaks (common when copying from a spreadsheet) are handled correctly.

Does any of my data get sent to a server?

No - the conversion happens entirely in your browser using JavaScript; nothing you paste is sent anywhere.

Meer in Converters & Utilities