CSV to JSON Converter
Convert CSV, TSV or semicolon-separated files into JSON with optional type inference. Handles quoted fields, embedded commas and newlines. No upload.
CSV input
How it works
- The CSV is parsed row by row with a proper state machine: quoted fields, escaped quotes (
""), embedded commas, and multiline fields are all handled. - With header enabled the first row becomes object keys; without it you get an array of arrays.
- Infer types turns numeric and boolean-looking strings into real numbers/booleans and empty cells into
null. - Every row in a header-driven result becomes one JSON object; missing cells become
null.
About CSV to JSON Converter
CSV is everywhere — spreadsheet exports, database dumps, analytics downloads — but its text format is awkward to consume in code. Converting to JSON gives you structured data you can feed directly into JavaScript, Python, or any API tooling. This converter parses CSV properly, not with a naive split(","): fields wrapped in quotes can contain commas, quotes, and even newlines, and a correct parser keeps those intact.
Export from Excel, Google Sheets, or your database, paste it here, and get JSON you can use immediately. Type inference keeps your numbers as numbers instead of strings, which matters for anything you will later sum, average, or chart. Pair this with the JSON to CSV tool on this site to go back the other way, or with the JSON Formatter on jsonversal.com to tidy the output.
What the state machine implements from RFC 4180
The parser walks the input character by character with a single `inQuotes` flag, which is the whole reason quoted fields survive. Outside quotes, a delimiter ends the current field and a line break ends the record. Inside quotes, delimiters and newlines are ordinary characters, and a doubled `""` collapses to one literal quote — the escape mechanism RFC 4180 specifies for fields containing their own delimiter, quote, or newline.
`RFC 4180` mandates CRLF as the record separator, but this parser also treats a lone `\n` and a lone `\r` as terminators, and specifically consumes `\r\n` as one break rather than two. That tolerance is why output from Unix tools, Windows tools and old Mac files all parse without a preprocessing step. A CRLF inside a multi-line quoted field is preserved as-is; only record separators are consumed.
Delimiter inference reads one line and picks a winner
Auto-detect scores four candidates — comma, tab, semicolon, pipe — by counting occurrences outside quotes in the first physical line only, then picks the highest count. The comparison is strict, so ties resolve to comma, as does a single-column file where every count is zero. Restricting the scan to one line has one failure mode: if the first field is a quoted multi-line value the line is truncated mid-field and the counts describe a fragment, which can select the wrong delimiter for the whole file. Choosing the delimiter explicitly removes the guess.
Type inference is a fixed pattern list rather than a general coercion. An empty cell becomes `null`. The exact strings `true`, `TRUE`, `True` and their false counterparts become booleans — `tRUE` does not qualify. Integers match `^[+-]?\d+$` with a length under 16, and floats match `^[+-]?\d*\.\d+([eE][+-]?\d+)?$`.
Where inference helps and where it quietly corrupts
Two consequences follow. `00123` matches the integer rule and becomes `123`, silently losing the leading zeros that make it a zip code or a product code — the value survives, the semantics do not. And `1e5` fails the float rule for lack of a decimal point, so scientific notation stays a string. The 16-character cutoff exists for a real reason: integers at or beyond 2^53 lose precision in JavaScript numbers, so they are left as text rather than rounded.
Dates and email addresses are left alone, which is the correct default. `2024-01-01` and `ada@example.com` fail both numeric patterns and stay strings, with no attempt to detect ISO dates or RFC 5322 addresses, so no timezone is assumed and no mailto link fabricated. Turn inference off when the source column is a numeric-looking identifier.
Row shape is positional and unvalidated. With the header option on, cells beyond the header count are dropped without warning, and a short row pads with `null` under inference or an empty string without it. With the header off you get an array of arrays — honest for a file with no header, but a mis-detected header row becomes a data row. Duplicate header names collide, since later columns overwrite earlier ones under the same key. A UTF-8 BOM from Excel is not stripped, so the first header reads as `\ufeffname`.
Frequently Asked Questions
How do I convert CSV to JSON?
Can I convert JSON back to CSV?
Is my data sent to a server?
Do I need an account or API key?
Can I use these tools offline?
All processing happens in your browser. No uploads, no tracking, no servers. Your API keys, configs, and private payloads stay private — 100% client-side.