Skip to content

CSV To JSON

Parse a bounded RFC 4180-style comma file locally and export string-preserving JSON without losing quoted commas, quotes, or line endings.

Privacy: your files never leave your device. All processing happens locally in your browser.

How to use

  1. 1.Paste comma-delimited CSV whose first record contains nonempty, unique header names.
  2. 2.Convert and verify the data-row, column, cell, and UTF-8 output-size summary.
  3. 3.Review that every value remains a JSON string, then copy or download converted.json.

About CSV To JSON

CSV to JSON Converter turns one comma-delimited text table into a pretty-printed JSON array in the current browser tab. Paste CSV whose first record contains headers, convert it, review the JSON, then copy it or download converted.json. Each data record becomes one object. Header order determines property order and every cell becomes a JSON string. The converter never guesses numbers, Booleans, null, dates, formulas, or empty values from spelling. Thus 001 stays "001", true stays "true", null stays "null", and an empty cell stays an empty string. The parser implements a finite RFC 4180-style dialect. Comma is the only delimiter. CRLF is the canonical record ending, while standalone LF and standalone CR are accepted interoperability extensions because real producers use them. A final record ending is optional and does not create another empty record. A second consecutive ending does represent a blank record. Tabs, semicolons, and pipes are field characters rather than alternate delimiters. The tool does not auto-detect dialects. Fields may be unquoted or enclosed in double quotes. A quoted field may contain commas, CRLF, LF, CR, and doubled double quotes. Two consecutive quotes inside a quoted field decode to one literal quote. An unquoted quote is an error. After a closing quote, only a comma, record ending, or end of input is accepted; a space or other trailing character is rejected instead of silently discarded. Embedded line endings inside quotes remain field data with their original CRLF, LF, or CR spelling. One leading U+FEFF is consumed before header parsing to support common UTF-8 BOM CSV files, including files whose first header is quoted. The raw input budget is checked before that removal. U+FEFF anywhere else remains data and is not stripped. A file containing only the BOM is empty after normalization and reports a required-input error. The first record is always the header in this product even though RFC 4180 permits header absence. Every header must contain at least one code unit after the optional leading BOM is removed. Empty first, middle, or final headers fail. Duplicate keys are rejected. Comparison is exact and case-sensitive, and whitespace is data, so a spaced header is not trimmed. Every data record must contain exactly the header's field count. Short or long rows fail with no partial JSON. Records are built as null-prototype objects before serialization. This makes __proto__, constructor, prototype, and toString ordinary own string keys rather than inherited behavior. JSON.stringify then escapes property names, quotes, backslashes, controls, and embedded line endings with two-space indentation. The result is valid JSON data, not executable code, and receiving applications must still parse and validate it. Limits are enforced before or during complete conversion and never as silent caps. Input may contain at most 5,000,000 UTF-16 code units. A table may contain at most 10,000 data rows after the header, 200 columns, and 200,000 data cells. Generated JSON may contain at most 10,000,000 UTF-8 bytes measured with TextEncoder rather than JavaScript string length. Exact boundaries are accepted and one unit, row, column, cell, or byte beyond a boundary fails explicitly. Multibyte Unicode output is measured by encoded bytes. The lower cell budget may reject a wide table before the row limit, which is intentional. The state machine distinguishes field start, unquoted content, quoted content, and content after a closing quote. It consumes CRLF as one ending outside quotes, preventing LF from becoming a blank row. It distinguishes one optional final ending from a genuine blank record and rejects an unclosed quote, a naked quote, or garbage after a closed quote. It does not repair mismatched quotes, merge uneven rows, trim fields, discard blank records, skip comments, recover a valid prefix, or infer a schema. Editing CSV immediately revokes the old JSON ObjectURL and clears output, errors, summary, copy state, and timer. Conversion failure leaves no stale download. Clipboard requests carry generation identities, so older permission completion cannot restore status after an edit or newer attempt. Copy timers are identity checked and canceled when replaced or unmounted. JSON ObjectURLs are revoked on editing, replacement, failure, and unmount. All parsing, object construction, UTF-8 measurement, copying, and Blob creation happen locally. No CSV or JSON is uploaded. The tool does not fetch linked values, evaluate spreadsheet formulas, flatten structures, deduplicate records, rename keys, normalize Unicode, or validate business meaning. Review headers and counts before import and retain the source CSV when original quoting or line-ending style matters.

Methodology & sources

Check the 5,000,000-code-unit raw budget, consume one leading U+FEFF, then parse with four explicit states. Use comma only; consume CRLF as one ending and accept LF or CR as interoperability extensions. Preserve commas and line endings inside quotes, decode doubled quotes, reject naked or trailing quote syntax, require nonempty unique exact headers, and require every row to match header width. Enforce 10,000 data rows, 200 columns, 200,000 cells, and 10,000,000 UTF-8 output bytes without partial results. Build null-prototype string-only records, serialize with JSON.stringify indentation, and measure with TextEncoder. Editing and failure clear output; clipboard generation, timer identity, mounted state, and ObjectURL cleanup prevent stale state and leaked downloads.

Frequently asked questions

Are numbers, true, false, or null converted to JSON types?
No. Every CSV cell remains a JSON string. For example, 001 stays "001" and null stays "null".
Which line endings and quoted values are supported?
CRLF, LF, and CR end records outside quotes. Quoted fields may contain those line endings, commas, and doubled double quotes.
What happens to a UTF-8 BOM?
One U+FEFF at the very beginning is consumed before header parsing. U+FEFF in any later position is preserved as field data.
Is the CSV uploaded?
No. Parsing, validation, JSON serialization, copying, and download creation happen locally in the current browser tab.

Developer Tools guides

View all