This CSV to JSON workflow converts one comma-delimited table into a JSON array of objects, using the first record as property names and keeping every cell as a JSON string.
The key distinction is structural conversion without type inference: CSV supplies text fields and row boundaries, while JSON represents named values and an array. This tool deliberately leaves type decisions to the receiving application, which must validate or coerce strings after parsing if richer types are required.

What changes during the conversion
The mapping is fixed and easy to inspect. Header names become property keys exactly as written, and their order determines the order of those properties in each generated object. The complete table becomes one pretty-printed JSON array rather than separate JSON documents.
| Input element | JSON result |
|---|---|
| First record | Exact property names in header order |
| Each later record | One object in the JSON array |
| Each cell | A JSON string value |
| Empty cell | An empty JSON string |
| Complete table | One pretty-printed JSON array |
For headers id,note,status, fields such as 001, "Acme, Inc.", and true become the JSON string values "001", "Acme, Inc.", and "true". The comma inside the quoted field remains part of one value rather than splitting it into two properties.
How records and quoted fields are parsed
The converter implements a finite RFC 4180-style dialect rather than automatically detecting different CSV formats. Its parsing rules are deliberately specific:
- Comma is the only delimiter. Tabs, semicolons, and pipes are ordinary field characters, not alternate delimiters.
- A field 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 double quote is an error. After a closing quote, only a comma, record ending, or end of input is accepted; a trailing space or other character is rejected.
Outside quoted fields, CRLF is the canonical record ending. Standalone LF and standalone CR are accepted interoperability extensions because different producers use them. The parser consumes CRLF as one ending, so its LF component does not create an extra blank row.
A final record ending is optional and does not create another empty record. A second consecutive ending, however, represents a blank record rather than a harmless extra terminator. Inside a quoted field, a line ending remains field data and retains its original CRLF, LF, or CR spelling.
One leading U+FEFF byte-order mark is consumed before header parsing, including when the first header is quoted. The raw-input budget is checked before that removal. A U+FEFF in any later position remains data, and input containing only the BOM is treated as empty after normalization.
The parser does not repair mismatched quotes, merge uneven rows, trim fields, discard blank records, skip comments, recover a valid prefix, or infer a schema.
Convert a CSV table locally
- Open CSV To JSON and paste comma-delimited CSV. Treat the first record as the header, and confirm that every header is nonempty and unique.
- Run the conversion. The parser validates the table before producing a complete result, so an invalid row causes an explicit failure rather than partial JSON.
- Review the summary for data rows, columns, data cells, and UTF-8 output size. Compare those figures with the source table before continuing.
- Inspect the generated JSON and confirm that every cell remains a JSON string. Pay particular attention to quoted commas, doubled quotes, embedded line endings, leading-zero values, and empty cells.
- Copy the complete JSON or download it as converted.json.
Parsing, validation, JSON serialization, copying, and download creation all happen locally in the current browser tab. No CSV or JSON is uploaded. Editing the input immediately clears the previous output and download, preventing a stale result from being exported after a change; a failed conversion also leaves no stale download.
Why every value stays a string
A CSV cell does not reliably declare whether its text represents a number, Boolean, null value, date, formula, or empty field. This converter never guesses from spelling, which makes the result predictable but leaves semantic type decisions to the application receiving it.
- 001 remains "001" instead of becoming the number 1.
- true and false remain strings rather than JSON Booleans.
- null remains "null" rather than becoming JSON null.
- An empty cell becomes "", an empty JSON string.
Date-like text and formula-like text are not interpreted either. After parsing the JSON, an application can deliberately validate and coerce selected fields if numeric, Boolean, nullable, or date values are required.
The records are serialized with two-space indentation. MDN’s JSON.stringify documentation describes how JSON serialization escapes property names, quotes, backslashes, control characters, and embedded line endings. The result is valid JSON data, not executable code, so a receiving application must still parse and validate it.
Records are constructed as null-prototype objects. As a result, header names such as __proto__, constructor, prototype, and toString become ordinary own string keys instead of inherited object behavior. Those unusual names still deserve review before import.
Header and row-width rules
RFC 4180 permits CSV files without a header, but this product always treats the first record as the header. That means a headerless data table cannot be passed through this workflow as though its first data row were optional.
- Every header must contain at least one code unit after the optional leading BOM is removed.
- Header names must be unique. Comparison is exact and case-sensitive, so ID and id are different keys.
- Whitespace is data and is not trimmed. A header containing a space retains that space.
- Every data record must contain exactly the same number of fields as the header.
A short row, long row, empty header, or duplicate header fails the conversion with no partial JSON. The converter does not add missing columns, discard extra fields, fill mismatched rows, or rename keys to make inconsistent input fit.
Limits checked by the converter
The bounds are enforced before or during the complete conversion. They are explicit limits, not silent truncation rules.
| Resource | Maximum accepted |
|---|---|
| Raw input | 5,000,000 UTF-16 code units |
| Data rows | 10,000 after the header |
| Columns | 200 |
| Data cells | 200,000 |
| Generated JSON | 10,000,000 UTF-8 bytes |
The raw-input limit is checked before the optional leading BOM is removed. Output size is measured in encoded UTF-8 bytes with TextEncoder, rather than by JavaScript string length, so multibyte Unicode characters count by their encoded size.
Exact boundary values are accepted. One additional code unit, row, column, cell, or output byte beyond a boundary fails explicitly. A wide table can hit the lower cell budget before the row limit, which is intentional, and no partial result is produced.
What JSON preserves and what it cannot reproduce
String preservation concerns parsed values, not a byte-for-byte copy of the source file. The JSON output does not recreate the original CSV quoting style, outside-field row terminators, or source-table layout. An embedded CRLF, LF, or CR inside a quoted field does remain exact field content. Retain the source CSV when its original quoting or line-ending style matters.
The conversion also has clear non-goals:
- It does not fetch values referenced by links.
- It does not evaluate spreadsheet formulas.
- It does not deduplicate records or rename keys.
- It does not flatten structures or normalize Unicode.
- It does not validate the business meaning of headers or values.
Before importing the file, compare the summary with the source, inspect the headers and representative values, and confirm that the receiving application expects strings. Valid JSON syntax establishes that the output is structurally parseable; it does not establish that the data has the intended schema or meaning.
Related reading: How to Check JSON Diff Results After Comparing.
Related reading: CSV to JSON for Beginners: Rows, Keys, and Strings.