CSV ↔ JSON converter

Paste either format, get the other. Header row becomes keys; quoted fields and embedded commas handled properly.

How to convert in either direction

  1. Paste CSV or JSON into the left box. The page loads with a small CSV sample so you can try the buttons immediately.
  2. Click CSV to JSON or JSON to CSV depending on which way you are going.
  3. Leave "detect numbers" checked if numeric-looking values should become real JSON numbers instead of strings.
  4. Copy the output from the right box. Errors, like a missing header row or invalid JSON, appear in red below the buttons.

A worked example

Use the sample already in the box:

name,age,city
Ada,42,"London, UK"
Linus,31,Helsinki

Click CSV to JSON and you get:

[
  {
    "name": "Ada",
    "age": 42,
    "city": "London, UK"
  },
  {
    "name": "Linus",
    "age": 31,
    "city": "Helsinki"
  }
]

Three things happened correctly that cheap converters get wrong: the quoted field "London, UK" survived as one value despite its embedded comma, the header row became the object keys, and with number detection on, the ages came through as numbers, not the strings "42" and "31". Click JSON to CSV on that output and you get the original table back, requoted where needed.

How the parsing works

The CSV side is a character-by-character parser following the RFC 4180 conventions: double quotes open and close fields, a doubled quote inside a quoted field means a literal quote, and newlines inside quotes are preserved as part of the value rather than starting a new row. Both Windows and Unix line endings are handled. Going the other way, the JSON side takes an array of objects, builds the header from the union of all keys in first-seen order (so objects with differing keys still produce a complete table, with blanks where a key is absent), and quotes any cell containing commas, quotes, or newlines. Nested objects are serialized as JSON strings inside their cell, which keeps the row rectangular. Everything runs in your browser, so a multi-megabyte export converts instantly and privately.

Honest limitations

The delimiter is the comma, full stop: semicolon-delimited files, common from European Excel installs, and tab-separated files will parse as one giant column. Run a find-and-replace to commas first, carefully, or export as real CSV. Number detection uses JavaScript's notion of numeric, which has a famous trap: values like 007 or a 16-digit account number will be converted to 7 and a precision-rounded float. For ID columns, uncheck "detect numbers" and accept strings everywhere; strings are always the safer default for identifiers. There is no streaming, so files that dwarf your browser's memory will fail, and JSON input must be an array of objects (or a single object), not deeply nested API responses, which you should flatten first.

Frequently asked questions

How are CSV headers used?

The first row becomes the JSON keys: a CSV with name,age columns produces objects like {"name": "Ada", "age": "42"}. Values stay as strings unless you enable "detect numbers".

What about commas inside values?

Standard CSV quoting is respected: "Smith, John" stays one field, doubled quotes ("") inside quoted fields become a literal quote, and newlines inside quotes are preserved.

What JSON shapes convert back to CSV?

An array of flat objects converts cleanly; keys become the header row, and the union of all keys is used when objects differ. Nested objects are serialized as JSON strings in their cell.

Is my data uploaded?

No. Conversion runs entirely in your browser, which also means multi-megabyte files convert instantly.