How to Convert CSV to JSON (and Back)

3 min read

Converting CSV to JSON means turning rows of comma-separated values into structured JSON, usually an array with one object per row and the header names as keys. CSV is what spreadsheets and databases export; JSON is what APIs, JavaScript, and most config-driven tools expect.

What the conversion looks like

This CSV:

name,email,plan
Ana Silva,ana@example.com,pro
Budi Santoso,budi@example.com,free

becomes:

[
  { "name": "Ana Silva", "email": "ana@example.com", "plan": "pro" },
  { "name": "Budi Santoso", "email": "budi@example.com", "plan": "free" }
]

Convert CSV to JSON in the browser

  1. Open the CSV to JSON Converter.
  2. Paste your CSV, or click Upload to load a .csv file.
  3. Keep Headers on so the first row becomes the object keys.
  4. Pick the Delimiter that matches your file (see below).
  5. Copy the JSON, or click Download.

Conversion runs as you type, entirely in your browser, so customer lists and exports stay on your device. Toggle Pretty to switch between indented and compact JSON.

Headers on or off

  • Headers on: each row becomes an object: { "name": "Ana Silva", ... }.
  • Headers off: each row becomes an array of values: ["Ana Silva", "ana@example.com", "pro"]. Use this when the file has no header row.

Picking the right delimiter

Not every "CSV" uses commas. Choose the delimiter chip that matches:

  • Comma: the default in most English-language exports.
  • Semicolon: common from Excel in locales that use a comma as the decimal separator, such as much of Europe, Brazil, and Indonesia.
  • Tab: TSV files and data copied straight from a spreadsheet.
  • Pipe (|): some database and log exports.

If every row comes out as a single long value, the delimiter is wrong.

Quoted fields and commas inside values

A field that contains the delimiter, a double quote, or a line break must be wrapped in double quotes, and inner quotes are doubled:

company,note
"Smith, Jones & Co","Said ""call after 5"""

This follows RFC 4180, and the converter parses it correctly. When you go from JSON back to CSV, it adds these quotes automatically where needed.

JSON back to CSV

Switch the mode to JSON → CSV, or click Swap to flip the current output into the input. Paste a JSON array:

  • Array of objects: the keys become the header row.
  • Array of arrays, such as [[1,2],[3,4]]: each inner array becomes a row.

This is the quick way to get API data into a spreadsheet: convert, download, and open the file in Excel or Google Sheets.

Things to watch

  • Everything is a string. CSV has no types, so "42" and "true" stay strings in the JSON. Cast them in your code if you need numbers or booleans.
  • Leading zeros. Postal codes and phone numbers keep their zeros in the converter, but spreadsheets may strip them when you open the CSV.
  • Encoding. If accented characters look garbled, re-export the CSV as UTF-8.
  • Empty trailing columns. An extra delimiter at the end of each line creates an empty column. Remove it at the source if it causes an unnamed key.

Summary

Paste or upload your file into the CSV to JSON Converter, match the delimiter, keep Headers on for objects, and copy the result. To tidy the output further, run it through the JSON Formatter; for config files, the YAML to JSON converter handles the other common format.