TBoxes

CSV to JSON

Paste CSV data and instantly convert it to a formatted JSON array

CSV (comma-separated values) is the oldest and simplest data interchange format that still sees daily use. Spreadsheets export to it, data scientists work with it, and many legacy systems produce it as their only structured output. JSON, by contrast, is the format almost every modern API, frontend, and document database expects. Moving from one to the other is one of the most common small data chores.

This converter takes CSV input, treats the first row as a header, and produces a JSON array where each subsequent row becomes an object keyed by those headers. It handles quoted fields that contain commas, escaped quotes, and empty cells. Everything runs in your browser, so a spreadsheet export that might contain confidential data never leaves your machine.

For small to medium files — up to a few megabytes — the conversion is instant. For very large files, command-line tools such as csvkit or the Python pandas library are faster and handle streaming, but for the one-off conversion that usually sits between a spreadsheet and an API, this tool is the fastest path from one format to the other.

About CSV to JSON Conversion

CSV (comma-separated values) is the oldest and simplest data interchange format that still sees daily use. Spreadsheets export to it, data scientists work with it, and many legacy systems produce it as their only structured output. JSON, by contrast, is the format almost every modern API, frontend, and document database expects. Moving from one to the other is one of the most common small data chores.

This converter takes CSV input, treats the first row as a header, and produces a JSON array where each subsequent row becomes an object keyed by those headers. It handles quoted fields that contain commas, escaped quotes, and empty cells. Everything runs in your browser, so a spreadsheet export that might contain confidential data never leaves your machine.

For small to medium files — up to a few megabytes — the conversion is instant. For very large files, command-line tools such as csvkit or the Python pandas library are faster and handle streaming, but for the one-off conversion that usually sits between a spreadsheet and an API, this tool is the fastest path from one format to the other.

How to Convert CSV to JSON

  1. Paste your CSV into the input area. Make sure the first row contains the column headers you want to use as JSON keys.
  2. The JSON output appears immediately, with one object per row.
  3. Copy the result, or save it to a file to feed into an API, a seed script, or a NoSQL import.
  4. If your output looks off, check the input for quoting problems — a stray unescaped quote inside a field is the usual culprit.

Examples

A small CSV

Input

name,email,role
Ada,ada@example.com,admin
Alan,alan@example.com,user

Output

[
  { "name": "Ada", "email": "ada@example.com", "role": "admin" },
  { "name": "Alan", "email": "alan@example.com", "role": "user" }
]

A field containing a comma

Input

name,bio
Ada,"mathematician, writer, first programmer"

Output

[
  { "name": "Ada", "bio": "mathematician, writer, first programmer" }
]

Wrap fields that contain commas in double quotes. A quote inside a quoted field is escaped by doubling it: "She said ""hi"".".

Common Use Cases

  • Preparing spreadsheet data for a bulk API import.
  • Seeding a development database from a CSV export.
  • Transforming a report into a format a JavaScript frontend can consume directly.
  • Sharing a small dataset with a developer in a format that pastes cleanly into code.

Tips

  • Decide on a header naming convention before you convert. JSON keys should be valid identifiers if you plan to access them as object.key rather than object['key'] — no spaces, no leading digits.
  • If your CSV uses a different delimiter (tab, semicolon), convert it to commas first or use a dedicated parser. CSV with semicolons is common in European locales where the comma is the decimal separator.
  • Numeric-looking values are strings by default in CSV. If you need them typed, post-process the JSON and coerce specific fields.

Frequently Asked Questions

Does the converter handle fields with commas inside them?

Yes, as long as those fields are properly quoted with double quotes. That is the standard CSV convention.

How do I escape a double quote inside a quoted field?

Double it. A field containing the literal string 'She said "hi"' is written as "She said ""hi""" in CSV.

Can I control the output format, such as pretty-printing or an array of arrays?

The default output is a pretty-printed array of objects keyed by the header row. If you need a different shape, post-process the JSON with a short script or use a library-based converter.

Is my CSV sent to a server?

No. The conversion runs entirely in your browser.

Related Tools