CSV ⇄ JSON Converter
Convert CSV to a JSON array of objects and back again, choosing comma, tab or semicolon as the delimiter. Quoted fields and embedded commas are handled.
Turn a CSV file into a JSON array of objects keyed by the header row, or turn an array of objects back into CSV. The delimiter is selectable, quoted fields containing the delimiter are parsed correctly, and the row and column counts confirm what was read.
Paste some CSV...
// CSV ⇄ JSON Converter: Features
The header row becomes the keys
Converting to JSON produces an array with one object per data row, where each object's keys come from the header row. That is the shape almost every API and library expects, and it is what makes the result immediately usable in code. Converting back, the keys of the first object determine the column order of the output, so reordering the keys reorders the columns.
Why the delimiter matters
The C in CSV stands for comma, but a great deal of real data uses something else. Exports from European locales commonly use a semicolon, because the comma is the decimal separator there and would otherwise be ambiguous. Data copied out of a spreadsheet arrives tab-separated. Picking the wrong delimiter produces a single enormous column rather than an error, which is why the choice is explicit rather than guessed.
Quoting is the part that goes wrong
A field containing the delimiter has to be wrapped in double quotes, and a double quote inside such a field is escaped by doubling it. Splitting a CSV line on commas without honouring quotes is the classic bug: an address field containing a comma quietly becomes two columns and every subsequent column shifts. The parser here follows the quoting rules, so a properly quoted file survives the round trip.
What CSV cannot represent
CSV is flat. A JSON array whose objects contain nested objects or arrays has no natural CSV equivalent, and any conversion has to flatten, stringify or drop the nested parts. If your data genuinely has structure, converting it to CSV loses that structure permanently. CSV also has no types: every value is text, so a leading zero in a product code survives in JSON and is at the mercy of whatever opens the CSV next.
Customer exports never leave your machine
Parsing and serialisation run in your browser and the content is never transmitted, stored or logged. Customer exports, internal reports and data extracted for a bug investigation can all be converted here. For tab-separated data specifically, the TSV converter is set up for it directly, and the JSON Formatter will tidy the output afterwards.
// CSV ⇄ JSON Converter: FAQ
What shape of JSON does a CSV become?
- An array of objects, one per data row, with keys taken from the header row. This is the form most APIs, database import tools and data libraries expect. Converting in the other direction, the tool expects that same shape and uses the keys of the first object to decide the columns.
Which delimiters are supported?
- Comma, tab and semicolon. Comma is the default, semicolon is common in exports from European locales where the comma is the decimal separator, and tab is what you get when you copy cells out of a spreadsheet. If your output looks like one giant column, the delimiter is almost certainly the reason.
Does it handle commas inside a field?
- Yes, provided the field is quoted, which is what the CSV convention requires. A value such as "London, UK" wrapped in double quotes is read as a single field, and a double quote inside a quoted field is written as two consecutive quotes. Unquoted commas inside a value are indistinguishable from delimiters and will split the field.
What happens to nested JSON?
- CSV has no way to express nesting, so an object or array inside a row cannot be represented faithfully. Flatten the data before converting if the nested values matter, for example by promoting user.name to its own column. Converting first and hoping is how information gets lost silently.
Are numbers converted to numbers?
- CSV carries no type information: every field is text. When converting to JSON the values are kept as they appear, which preserves things that matter such as leading zeros in postcodes and product codes. If you need real numbers, convert the relevant fields after import, where you control which columns should change.
What if rows have different numbers of fields?
- A row with fewer fields than the header leaves the remaining keys empty, and a row with more fields has the extras dropped, because there is no key to attach them to. A ragged file is usually a sign of unquoted delimiters inside a value, so check the quoting before assuming the data itself is inconsistent.
Does it preserve the column order?
- Yes. Converting to JSON keeps the header order as the key order of each object, and converting back uses the key order of the first object as the column order. Reordering the keys in the JSON is therefore the way to reorder the CSV columns.
Can it handle line breaks inside a field?
- A quoted field may contain a line break according to the convention, and this is common in exported comment or description columns. Make sure such fields are properly quoted in the source; an unquoted line break is indistinguishable from the end of the row.
Is it safe to paste customer data?
- The conversion runs entirely in your browser and nothing is transmitted, stored or logged, so no third party receives the data. Your own organisation may still have rules about where personal data may be processed, and those apply here as they would to any website.
Is my CSV or JSON sent to a server?
- No. Everything happens in the page, and closing the tab discards what you pasted.
// How to Use CSV ⇄ JSON Converter
-
Choose the direction and delimiter
Select CSV to JSON or JSON to CSV, then set the delimiter to comma, tab or semicolon to match your data. Getting the delimiter right is the single most important step.
-
Paste the CSV or the JSON
Put the CSV, including its header row, or the JSON array into the input box. Conversion happens as you type and the row and column counts confirm how the input was read.
-
Check the counts and copy
Compare the reported row and column counts against what you expected before copying. A column count that is too low usually means the delimiter is wrong; one that is too high usually means an unquoted delimiter inside a value.
Category Data Formats