csv-json-converter
Convert CSV to JSON, or JSON back to CSV, right in your browser. Quoted fields, commas and newlines embedded inside quotes, and doubled-up "" escaped quotes are all handled by a real character-by-character parser — not a split(',') that breaks on the first edge case. Comma, semicolon, and tab delimiters are all supported.
client-side only RFC 4180 parsing comma / semicolon / tab
// csv → json
input.csv
output.json
Result appears here.
// json → csv
input.json
output.csv
Result appears here.
// why not just split(',')
// json → csv with mismatched keys
JSON objects in an array don't have to share identical keys — one record might be missing a field another one has. The header row here is the union of every key seen across all objects, in the order each key first appears; any object missing a given key just gets an empty cell in that column instead of the conversion failing.
// picking a delimiter
- Comma — the default for CSV almost everywhere English-locale tools export it, including Excel (US), most REST API exports, and database bulk-export tools.
- Semicolon — common in European-locale exports (Excel configured for a locale that uses
,as the decimal separator switches its CSV delimiter to;to avoid ambiguity with decimal numbers). - Tab (TSV) — common for pasting into or out of spreadsheet apps, and for data that's likely to contain commas in nearly every field (addresses, free text), where tabs are less likely to collide.
Real-world CSV allows a field to contain the delimiter, a quote character, or a newline — as long as the whole field is wrapped in double quotes (
"New York, NY"), and a literal quote inside a quoted field is written as two quotes in a row ("she said ""hi"""→she said "hi"). A regex or a plainsplit(',')has no notion of "inside a quoted field," so it silently splits on commas that were never meant to be delimiters. This tool instead walks the text character by character, tracking whether it's currently inside a quoted field, which is the only way to get all of that right — including a field that spans multiple lines because it's quoted.