CSV to JSON

Turn tabular rows into JSON objects, arrays or JSONL, without the data leaving this tab.

Runs on your deviceDeveloperWorkingNo account needed

What this tool does

CSV to JSON reads your text with a parser that follows the usual RFC 4180 conventions: a field may be wrapped in double quotes, a doubled quote inside such a field is a literal quote, and a quoted field may contain the delimiter or a line break without ending the row. Blank lines are skipped. When the first row holds names, an empty header cell is named column1, column2 by its position, and a name that repeats picks up a _2 suffix so one column cannot silently overwrite another.

Type conversion is the setting worth understanding, because it is where a converter can quietly damage data. With it on, 12 becomes a number, true and yes become true, false and no become false, and both the word null and an empty cell become null. What deliberately stays text is the interesting half: a leading zero as in 00100, a leading plus as in +44, and anything past JavaScript's safe integer range are all left as strings rather than rounded or trimmed. Postcodes, account numbers and long references survive. The guard is on the size of the number rather than on how many characters it has, so a decimal fraction carrying more figures than a double can hold is still converted and comes back rounded. Switch conversion off and every cell arrives exactly as it was written.

Three output shapes are offered. Array of objects is the default and keys each row by the header names. Array of arrays keeps the header itself as the first array, which suits code that walks by column index. JSONL writes one compact record per line — an object where a header row supplies the keys, a bare list where it does not — which is the format bulk-import endpoints and log pipelines expect; the indentation setting has no effect there, because each JSONL line is minified by design. All of this happens in this browser tab using the page's own parser, so the rows are not uploaded, not logged and not stored anywhere.

Two constraints shape what this converter can be asked to do. The input box takes pasted text and there is no file picker, so the ceiling is your clipboard and your device's memory: a few megabytes converts without fuss, a large export will make the tab work for it. And CSV is flat, so the JSON is flat too. A column headed address.city becomes a key spelled address.city rather than a nested object, a row carrying more fields than the header loses the extra ones, and malformed quoting is never reported as an error: an unmatched quote swallows the rest of the text into a single field, while a matched pair of stray quotes inside an otherwise unquoted cell is quietly stripped out. Both show up in the output rather than in a message.

How to use it

  1. Paste the rows. Drop the CSV into the input box, or press Load sample for a short table that includes a quoted field with a comma inside it. Tab- and semicolon-separated exports go in the same box.
  2. Set the delimiter, or let it be detected. Detection counts commas, semicolons, tabs and pipes across the first five lines and takes the most frequent. Pick the delimiter yourself when the cells are full of a character your file does not separate on.
  3. Say whether the first row holds the column names. With it ticked those names become the JSON keys. Unticked, every row is converted as a list of values instead.
  4. Choose conversion, shape and indentation. Objects, arrays or JSONL; two spaces, four spaces or minified. Untick the conversion box when every column should stay a string.

Processing & privacy

Runs on your device. Your file is processed directly in this browser.

Common use cases

Moving a spreadsheet export into code

Excel and Google Sheets both export CSV. Converting the sheet to JSON gives you something fetch, jq or a test fixture can read without pulling in a CSV library.

Seeding a database or an import endpoint

Bulk loaders usually want JSONL. One object per line means the file can be streamed and a single bad record rejected on its own.

Seeing what an export actually contains

Field names, row count and which cells came back empty are far easier to read as JSON than in a wall of commas.

Building a fixture from real data

Convert a sample of the rows with conversion on, and the fixture carries numbers as numbers instead of quoted digits.

Questions

Is my CSV uploaded anywhere?
No. Parsing the rows and writing the JSON both happen in this browser tab, so nothing is transmitted or kept. Load the page once and the conversion keeps working with the connection cut.
Will type conversion break my identifiers?
It is written to avoid the cases that bite most often. A value with a leading zero, a leading plus sign, or a whole number too large for JavaScript to hold exactly is left as text, so 00100, +4477 and a twenty-digit reference all come through unchanged. The test looks at the magnitude of the number and not at its length, though, so a decimal fraction with more figures than a double can represent is converted anyway and comes back rounded. If you would rather not think about any of it, untick the conversion box and every cell stays a string.
Can it produce nested JSON?
No. A row is flat, so the output is flat: a column headed address.city becomes a key spelled address.city, not an object with city inside. Reshape the result in code if you need depth. Going the other way, JSON to CSV flattens nested objects into dotted columns, so a round trip through both tools leaves you with flat keys either way.
What if a row carries more or fewer fields than the header?
A short row fills the missing keys with null when conversion is on, or with an empty string when it is off. A long row loses its extra cells, because only the columns named in the header are read. Neither case is flagged, and the summary line will not give it away either: it counts rows and header fields, so it reads the same whether the rows are ragged or square. Ragged input has to be spotted in the JSON itself.
Why did I get an array of arrays when I asked for objects?
Because the header checkbox is off. With no first row of names there are no keys to build objects from, so each row is converted as a list of values whatever the shape setting says.
Does the delimiter detection ever guess wrong?
It can. It counts each candidate character across the first five lines and picks the most common, including characters sitting inside quoted text. A comma-delimited file whose cells are full of semicolons can be read the wrong way — set the delimiter explicitly and the guessing stops.
How much data can it take?
No limit is imposed, but there is no file picker either: you paste the text, so the clipboard and your device's memory are the real constraint. Tens of megabytes will make the tab hesitate.

Related tools