Skip to content
FileKit
Data And FormatsRuns in your browser6 min read

CSV to JSON Converter

This CSV to JSON converter reads a CSV file and produces a clean JSON array of objects, one per row. Unlike a naive tool that splits every line on a comma, this one is a real RFC 4180 parser, so a field containing a comma inside quotes, a line break inside quotes or a doubled quote as an escape all parse exactly the way a spreadsheet would write them.

Loading the tool interface
Files never leave your deviceNo upload wait and no queueNo signup, watermark or file limit

That distinction matters more than it sounds. A file exported from Excel or Google Sheets routinely contains an address, a note or a product description with a comma or a line break inside a single quoted cell. A split on comma tool silently shifts every column after that cell, corrupting the row without any error message. A correct parser tracks whether it is currently inside a quoted field and only treats a comma or a newline as a separator when it is not.

Everything happens locally. The CSV text is walked character by character in your browser, converted into rows, and turned into JSON with your chosen header and type settings, all before anything is downloaded. No file is uploaded to a server, which matters when the CSV in question is a customer list, an export from a paid tool or anything else you would rather not send anywhere.

Why you need a real parser to convert CSV to JSON

CSV looks simple and is not. The RFC 4180 specification defines a small set of rules: fields are separated by a delimiter, a field containing the delimiter, a quote or a newline must be wrapped in double quotes, and a literal quote inside a quoted field is written as two quote characters in a row. Every one of those rules breaks a naive split(",") approach.

To convert csv to json correctly, a parser has to track one piece of state as it reads: whether it is currently inside a quoted field. Only outside a quoted field does a comma end a column and a newline end a row. Inside a quoted field, both characters are just data. This converter implements exactly that state machine rather than a regular expression or a string split, so it handles the CSV files that actually come out of real spreadsheet software.

How this tool handles CSV with quoted commas

A row like `1,"Ada, Lovelace","Mathematician, writer"` has three intended columns even though it contains two extra commas. Because the parser is state aware, it recognises that the commas inside the quoted csv with quoted commas fields are data, not separators, and produces exactly three values for that row.

The same logic applies to a quote character that needs to appear inside a value. RFC 4180 escapes it by doubling: `"""analytical engine"""` decodes to the literal text "analytical engine" surrounded by real quote marks. A field that starts with a quote but forgets to close it is a genuine error, and this tool reports the exact line and column where the unterminated quote began rather than silently producing garbled output.

Embedded newlines follow the same rule. A quoted field can contain a raw line break, and the parser keeps building that field across multiple physical lines of the file until the closing quote appears, so a multi line note in a CSV cell becomes one JSON string value with the line break preserved rather than being cut into two separate rows.

The CSV header row option

Most CSV files start with a csv header row that names every column, and by default this converter reads that row and uses its values as JSON object keys. Turn the header option off for files that start straight into data, and the tool falls back to generic names like column_1 and column_2 so every row still becomes a complete object.

When a header row is present but a column name is blank, the same generic naming pattern fills the gap, so an accidental empty header cell never produces a broken or missing key in the output JSON.

What type inference does and when to turn it off

CSV has no type system. Every cell is text, even a cell that visually looks like the number 42 or the word true. With type inference on, this converter recognises integers, decimals, the literal words true and false, and empty cells, and turns them into a JSON number, boolean or null respectively rather than leaving everything as a string.

Turn inference off when a column contains values that look numeric but should stay text, such as a zip code with a leading zero, a phone number or an account identifier. Leaving those as strings avoids the classic spreadsheet bug where a leading zero silently disappears because something upstream treated the value as a number.

How this CSV to JSON converter works under the hood

The parser reads the input one character at a time and tracks the current line and column as it goes, which is what lets it point to the exact position of a malformed quote instead of failing with a vague message. Once every row is split into fields, the header row and the type inference setting decide how each field is converted into a JSON value.

Because parsing happens with plain JavaScript running in your browser tab, there is no upload step and no server side queue. You can verify this yourself by opening your browser's network panel while converting a file and watching it stay empty, and it means a CSV of any reasonable size is limited only by your own device's memory.

Common problems when you parse csv file exports

Files saved from older versions of Excel on Windows sometimes use a Windows line ending inside quoted fields, which this parser normalises correctly since it treats a carriage return followed by a line feed as one line break rather than two. Files exported from European spreadsheet locales sometimes use a semicolon delimiter instead of a comma, which the delimiter setting handles directly.

A row with fewer columns than the header simply produces missing keys with an empty or null value rather than throwing an error, since real world exports frequently have a trailing row shorter than the rest. This keeps the conversion resilient to the kind of small inconsistencies that show up in hand edited spreadsheets.

How a naive split compares with this RFC 4180 parser
Casesplit(",") resultThis parser's result
Comma inside quotesSplits into an extra columnKept as one field
Doubled quote escapeLeft as two quote charactersDecoded to one literal quote
Newline inside quotesBreaks the row in twoKept as one multi line field
Missing trailing columnThrows off alignmentFilled with an empty value

How to convert CSV to JSON

  1. 1

    Add your CSV

    Paste CSV text into the box, or drop a .csv file onto the upload area. The file stays on your device.

  2. 2

    Choose the delimiter

    Comma is the default. Switch to semicolon, tab or pipe if that is what your file actually uses.

  3. 3

    Set the header and type options

    Leave the header toggle on if row one holds column names, and leave type inference on for numbers and booleans.

  4. 4

    Convert and download

    Press convert, check the row and column counts, then download the JSON file or copy it to your clipboard.

Related tools worth bookmarking

Sources and further reading

Frequently asked questions

Common questions about the csv to json converter.

It tracks whether the parser is currently inside a quoted field, and only treats a comma as a column separator when it is not. A comma that appears inside double quotes is read as literal data, so a value like "Lovelace, Ada" stays as a single field instead of being split in two.

The tool reports a clear error naming the exact line and column where the unclosed quote started, rather than silently producing corrupted or shifted rows. Fixing the missing closing quote in your source file and converting again resolves the error.

Yes. Turn off the header row option and every column is given a generic name such as column_1 and column_2 in the resulting JSON objects. This is the right setting for files that begin directly with data rather than a row of column titles.

It can, for columns that look numeric but should stay text, such as zip codes with a leading zero or long account numbers. Turn type inference off for those files so every value stays a string exactly as written in the source CSV, with no reformatting applied.

Yes. A quoted field can contain a raw newline, and the parser keeps reading across multiple physical lines until it finds the closing quote, so a multi line note or address in a single cell becomes one JSON string with the line break preserved rather than being split into extra rows.

No. Parsing and JSON conversion both happen in your browser using JavaScript, so a customer list or any other sensitive export never leaves your device. You can confirm this by watching your browser's network panel while a conversion runs.