Guides/

How to Convert CSV to JSON

CSV to JSON is one of the most searched data conversions there is. APIs want structured data. Spreadsheets give you rows. CSVUtility and the website tool both do this locally. They do not produce the same JSON shape, on purpose.

In the browser: objects keyed by headers

The CSV to JSON tool runs in your tab. Drop a file or paste text. Auto-detect comma, tab, semicolon, or pipe. Copy or download.

Each data row becomes an object. The first row becomes keys:

[
  { "id": "1", "name": "Northwind", "active": "true" },
  { "id": "2", "name": "Contoso", "active": "false" }
]

Values stay strings, so leading zeros survive. Limits: about 15 MB, first 10,000 data rows. Nothing is uploaded.

Turn off First row is a header if there is no header. You will get column_1, column_2, and so on.

In CSVUtility: a JSON array of rows

Select the cells (include the header row if you want it in the payload). Then Edit → Copy As → JSON.

That command pretty-prints the selection as a JSON array of arrays, using Apple’s JSONSerialization. Empty selection copies nothing useful. A selection that includes the header looks like:

[
  [
    "id",
    "name",
    "active"
  ],
  [
    "1",
    "Northwind",
    "true"
  ]
]

There are no object keys. The first inner array is just another row. That is a faithful dump of the grid, which is what you want when feeding a script that already knows column order.

The same menu has Markdown Table (first selected row becomes the header line, | escaped, newlines as <br>) and SQL INSERT (INSERT INTO table_name VALUES, empty cells as NULL, numeric-looking cells left unquoted).

Which one to use

  • Need { "email": "…" } objects for an API? Use the browser converter, or reshape the Copy As JSON array in code.
  • Need an exact snapshot of a range, including the header as row zero? Use Copy As → JSON in CSVUtility.
  • File is huge? Select a slice in CSVUtility. Do not paste a 4 GB dump into a browser tab.

Gotchas

  • Quoted commas. A real parser keeps "Bedford, Kye" as one field. Splitting on commas in a text editor will not.
  • UTF-8. If names look like café, fix encoding before you convert. See CSV encoding on Mac.
  • Duplicate headings. Object-style JSON cannot usefully have two keys named email. Rename a column in CSVUtility first (Edit → Column → Rename…).

Need Markdown or INSERT statements from a small file without opening the app? Use CSV to Markdown and CSV to SQL. Those website tools also stay in the browser. The SQL tool names columns and a table you choose. CSVUtility’s Copy As → SQL INSERT always uses table_name and omits the column list.

Need this on a large file?

CSVUtility opens huge CSVs on a Mac. Search, filter, and compare changes without waiting on a spinner.

Download for MacOS