Tools Guides
developer Free No signup

CSV ↔ JSON Converter

Convert CSV data to JSON and JSON arrays back to CSV — with delimiter options and live preview.

Loading tool…

About this tool

Bidirectional CSV and JSON converter. Paste CSV to get a JSON array of objects (using the first row as keys), or paste a JSON array to export it as CSV. Supports custom delimiters (comma, semicolon, tab) and handles quoted fields correctly.

How to use

  1. 1 Paste CSV data (with header row) into the input and click 'CSV → JSON'.
  2. 2 Or paste a JSON array of objects and click 'JSON → CSV'.
  3. 3 Select delimiter if your CSV uses semicolons or tabs.
  4. 4 Copy the result with the Copy button.

What CSV and JSON each get right

CSV (comma-separated values) and JSON (JavaScript Object Notation) are the two formats most data passes through on its way between a spreadsheet and a program. CSV is a flat grid: one header row names the columns, and every line below it is a record whose fields line up in the same order. It is compact and opens in Excel, Google Sheets, or any text editor. JSON, by contrast, is a tree of objects and arrays — it labels every value with a key, so a program can read a field by name instead of counting columns. This converter moves your data both directions: CSV becomes a JSON array of objects keyed by the header row, and a JSON array of objects collapses back into CSV. Everything runs in your browser, so the data you paste never leaves your device.

How the conversion actually works

Going CSV to JSON, the tool reads the first non-empty line as the list of keys. Each following line becomes one object: the value in column 1 is attached to header 1, column 2 to header 2, and so on. So three columns named name,age,city turn every row into an object with exactly those three keys. The parser is quote-aware — it walks the line character by character, and when it meets a double quote it stops treating delimiters as separators until the closing quote, so a comma inside a quoted field is kept as data rather than splitting the cell. A doubled quote ("") inside a quoted field is correctly read as one literal quote character.

Going JSON to CSV, the tool takes the keys of the first object as the header row, then writes each object's values in that same column order. When it writes a cell, it automatically wraps the value in quotes if the value itself contains the delimiter, a quote, or a newline, and it escapes any embedded quotes by doubling them. That escaping is what keeps the output valid CSV that re-imports cleanly.

A worked example

Paste this CSV with the delimiter set to comma:

  • name,role,note
  • Ada,engineer,"likes tea, biscuits"
  • Grace,admiral,founder

Click CSV → JSON and you get an array of two objects. The first is {"name":"Ada","role":"engineer","note":"likes tea, biscuits"} — notice the comma stayed inside the note field because it was quoted, and the surrounding quotes were stripped. The output panel reports "2 rows". Turn off Pretty-print and the same data collapses to a single minified line; leave it on and the JSON is indented two spaces for readability. Now copy that JSON back into the input, click JSON → CSV, and the tool re-quotes Ada's note (because it contains a comma) so the round trip is lossless.

Choosing the right delimiter

The delimiter dropdown matters more than it looks. Comma is the default, but data exported from European spreadsheets often uses a semicolon, because the comma is their decimal separator. Tab-separated values (TSV) avoid the comma problem entirely and are common in scientific and database exports. Pick the delimiter that matches your source before converting — if you parse a semicolon file as comma-delimited, the whole row lands in a single mislabelled key. The same delimiter setting is used when writing CSV back out, so you can also use this tool to switch a file from semicolon to comma.

Use cases

  • Feeding an API. Many web APIs accept JSON but not CSV. Export a spreadsheet to CSV, convert here, and paste the array straight into a request body or a seed file.
  • Reviewing an API response. A JSON array of records is hard to scan; convert it to CSV and open it in a spreadsheet to sort and filter.
  • Quick reshaping. Round-trip CSV to JSON and back to normalise inconsistent quoting, or to re-export with a different delimiter.
  • Config and fixtures. Turn a small lookup table into a JSON array for test fixtures or front-end mock data.

Common mistakes to avoid

  • Expecting type conversion. Every value comes out of the CSV parser as a string. age of 30 becomes "30", not the number 30. If your program needs real numbers or booleans, cast them after import.
  • Unquoted commas. A field that contains a comma but isn't wrapped in quotes will be split into two columns and shift everything after it. Quote such fields in the source.
  • Feeding JSON that isn't an array. The JSON → CSV direction requires a top-level array of objects. A single bare object or a nested structure raises a parse error, because CSV has no way to represent nesting in one flat grid.
  • Ragged rows. If a row has fewer cells than there are headers, the missing keys are filled with empty strings rather than dropped — handy, but check that a short row was intentional and not a stray delimiter.
  • Duplicate header names. Two columns with the same header collapse into one key in the object, because object keys must be unique. Rename duplicate columns before converting.

Frequently Asked Questions

{# Alpine.js — self-hosted. (The previous jsdelivr CDN tag had a stale SRI integrity hash, so the browser refused to run it and window.Alpine was never defined — silently breaking every FAQ accordion and Alpine tool.) #}