CSV to JSON Converter
Paste or upload a CSV/TSV file and get clean JSON instantly. Handles quoted fields, custom delimiters, type inference, and nested keys — all in your browser, with nothing uploaded. Copy or download in one click.
How it works
This converter is a deterministic format transformation: it reads CSV text shaped by RFC 4180 and emits JSON shaped by RFC 8259. There is no external API and no server round-trip — the entire pipeline runs in your browser, so spreadsheet exports, payroll files, and client lists never leave your device.
- Decode & clean. The input is read as UTF-8, a leading byte-order mark (BOM) is stripped per the WHATWG Encoding Standard, and line endings (
\r\nor\r) are normalised to\n. - Detect the delimiter. On Auto, the first non-empty line is sampled and the unquoted occurrences of comma, semicolon, tab, and pipe are counted; the highest wins. Any manual choice always overrides detection.
- Tokenize per RFC 4180 §2. A single-pass state machine reads fields that may be wrapped in double quotes; inside a quoted field a literal quote is written as
"", and quoted fields may contain the delimiter and line breaks. That is why"Owes Rs 1,200"stays one field. Unquoted fields are optionally trimmed of surrounding spaces. - Build keys. With a header row, the first record supplies the object keys; blank keys become
column_Nand duplicates are suffixed_2,_3, each with a note. Rows shorter than the header are padded withnull; longer rows overflow into extra columns. Adjustments are warnings, never errors. - Infer types (optional). Per cell, in order: empty →
null; a numeric literal within the IEEE-754 safe-integer range → number; case-insensitivetrue/false→ boolean; otherwise the string is kept. To protect identifiers, a value with a leading zero (a phone number such as0712345678) and an integer past 253−1 are deliberately kept as strings so no precision is lost. Inference is per-cell, so one stray value never re-types the column. - Nest by dot-notation. Header keys containing a dot —
address.city— build nested objects, and numeric segments build arrays. - Serialize per RFC 8259 §7–9. Output is produced with the native
JSON.stringify, which already escapes strings and emits valid number, boolean, and null literals.
Every successful run is cross-checked: the emitted text is parsed back with the browser's standards-compliant JSON.parse and the record count must match what was read from the CSV. The summary line under the output reports the verified record count and the delimiter that was used.
Worked examples
Frequently asked questions
Sources & references
- RFC 4180 — Common Format and MIME Type for CSV Files (quoting & record rules)
- RFC 8259 — The JavaScript Object Notation (JSON) Data Interchange Format
- WHATWG Encoding Standard — UTF-8 BOM handling
The parsing and serialization rules on this page were last cross-checked against RFC 4180 and RFC 8259 on 2026-06-26. The page is reviewed whenever a relevant standard or edge-case bug report comes in.
Related tools
Comments & feedback
Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.
Found a CSV edge case that does not parse right, or want a new option?
Email me at [email protected] — most fixes ship within 24 hours.