My Tool Studio
Developer Tools·3 min read

CSV to JSON: Turn Spreadsheet Rows Into Objects

Spreadsheets and database exports hand you CSV. Code and APIs want JSON. The CSV to JSON Converter reads a table and turns every row into a JSON object, with the header cells as keys. Paste the data, upload a .csv file or an Excel sheet, or load a CSV from a URL. Parsing runs in your browser.

.csv.jsonCSV → JSON

What the converter does

A table in, JSON out.

By default the first row is the header and each following row becomes one object in a JSON array. Untick First row is the header and the keys become field1, field2 and so on. Quoted fields that contain commas or line breaks parse correctly, so a quoted value like Smith, Bob stays one value.

Numbers and true or false become real JSON types. The Empty cells menu decides what an empty cell becomes: an empty string, which is the default, null, or no key at all. Completely blank lines are skipped.

An array of objects is not the only shape. The Output menu can also give an array of arrays, an object keyed by the first column, or one array per column. Output can be indented, minified or written as JSON Lines.

How to convert CSV to JSON

Three steps.

The whole job takes a few seconds for an everyday export.

  • Paste CSV or TSV into the input, drop or upload a .csv, .xlsx, .xls or .ods file, use Load URL, or press Try sample.
  • Leave Delimiter on Auto-detect or pick one, check the header setting, then pick the Output, Indent, Empty cells and Nested keys options. Press Convert to JSON.
  • Press Copy, or Download to save .json (.jsonl for JSON Lines).

Delimiters and TSV

Not every CSV uses commas.

Auto-detect looks at the first lines and guesses the separator. Pick one yourself when the guess is wrong, for example for semicolon files saved by Excel in many European locales, or for a file with a single column.

Tab-separated data works too. Cells copied straight from Excel or Google Sheets are tab-separated, so you can paste a selected range and convert it.

Leading zeros in zip codes and IDs

Real data stays intact.

Number detection only turns a value into a number when it is written like a plain JSON number. So 02134, +44 20 and very long IDs stay strings with their zeros and digits intact, while 9.99 becomes a number. You no longer have to switch detection off to protect codes.

If you want every value as text anyway, untick Detect numbers and booleans. And if a file arrives with zeros already missing, the damage happened before the CSV was saved, usually when a spreadsheet opened it and read the column as numbers.

Rows that do not match the header

Nothing is silently dropped.

A row with too few or too many fields is still converted, and a warning below the panes says how many rows had a different number of fields. Missing fields get the Empty cells value. Extra fields are kept in an array under the key _extra, so no data is lost. Show the parsed table lets you see the rows as they were read, which helps you find the bad line in the source.

From Excel, and back again

The round trip.

You can upload an .xlsx, .xls or .ods file directly. Each sheet is read in your browser, and when a workbook has several sheets, a Sheet menu lets you switch between them.

Headers like address.city give a flat key named address.city by default. Set Nested keys to split on a dot, a slash or a double underscore, and they become nested objects instead. When you need to go the other way, the JSON to CSV Converter turns an array of objects back into rows. To compare two CSV files instead of converting them, Text Compare (Diff Checker) shows every line that changed.

Try it now

Open CSV to JSON Converter

The tool is one click away. No sign up, no upload, no payment.

Open CSV to JSON Converter