FREE TOOL · NO SIGNUP · RUNS IN YOUR BROWSER

Convert CSV to JSON (and Back)

Paste CSV, pick your delimiter and header options, and get a clean JSON array of objects instantly — or flip it to turn JSON back into CSV. Copy or download in one click; nothing ever leaves your device.

CSV input

Options

Example CSV → JSON — paste your own CSV on the left to convert it.
3rows
5cols
Commadelimiter
422 Bsize
JSON output
[
  {
    "name": "Ada Lovelace",
    "role": "Engineer",
    "city": "London, UK",
    "active": true,
    "joined": "2024-01-15"
  },
  {
    "name": "Grace Hopper",
    "role": "Admiral",
    "city": "Arlington, VA",
    "active": true,
    "joined": "2023-11-02"
  },
  {
    "name": "Katherine \"Kat\" Johnson",
    "role": "Mathematician",
    "city": "Hampton",
    "active": false,
    "joined": "2022-06-30"
  }
]
The Complete Guide

CSV to JSON: How to Convert Data Cleanly Every Time

5 MIN READ

Understand with AI

Discuss with your preferred AI assistant

< 1s
Conversion time

Pasted data is parsed and converted instantly in the browser — no upload, no waiting on a server.

4+
Delimiters supported

Comma, semicolon, tab, and pipe are all handled, with auto-detection for unknown exports.

0 KB
Data uploaded

Everything runs locally in JavaScript, so your CSV and JSON never leave your device.

CSV and JSON are the two formats most data passes through on its way somewhere useful. CSV is what spreadsheets, analytics exports, and databases hand you; JSON is what APIs, JavaScript apps, and modern config files expect. Converting between them by hand is tedious and error-prone — one stray comma inside a value and the whole file falls apart. A reliable converter does the parsing for you in seconds.

This guide explains exactly how CSV-to-JSON conversion works, the edge cases that quietly break naive tools, and how to get a clean, type-correct result every time — whether you are wiring up an API, seeding a database, or prepping a dataset for analysis.

What Is CSV to JSON Conversion?

CSV (comma-separated values) stores tabular data as plain text: one row per line, fields separated by a delimiter. JSON (JavaScript Object Notation) stores the same data as a structured array of objects, where each object's keys come from the header row. Converting CSV to JSON turns a flat grid into named key–value pairs that code can read directly.

For example, a CSV with a name, role, and city header becomes an array of objects, each with name, role, and city properties. Going the other direction — JSON to CSV — flattens those objects back into rows and columns for spreadsheets and bulk imports.

How to Convert CSV to JSON

1. Paste your CSV and pick a delimiter

Most files use a comma, but European exports often use a semicolon, and database dumps frequently use a tab or pipe. A good converter can auto-detect the delimiter by sampling the first few rows, or you can set it explicitly to avoid surprises.

2. Tell the tool whether the first row is a header

If the first row contains column names, the converter uses them as JSON keys. If your file has no header, the tool generates positional keys like column_1, column_2, and so on, so no data is lost.

3. Decide how values should be typed

By default every CSV value is a string. With auto-typing enabled, the converter promotes 42 to a number, true/false to booleans, and empty cells to empty strings — producing JSON your code can use without extra parsing.

4. Copy or download the result

Once the JSON looks right, copy it to the clipboard for a quick paste, or download a .json file for your project. Reverse the direction at any time to turn JSON back into a spreadsheet-ready CSV.

The Edge Cases That Break Naive Converters

Splitting on commas with text.split(',') works until your data contains the cases below. A correct parser follows the RFC 4180 convention and handles all of them:

  • Commas inside values — a city field like "London, UK" is wrapped in quotes so the comma is treated as text, not a separator.
  • Quotes inside values — a literal quote is escaped by doubling it (""), as in "Katherine ""Kat"" Johnson".
  • Newlines inside values — a multi-line address can sit inside one quoted field and span several physical lines while still being a single cell.
  • Mixed line endings — Windows files use CRLF (\r\n) while Unix files use LF (\n); both must parse identically.
  • Ragged rows — when a row has fewer columns than the header, missing fields should fill with empty values rather than shifting every later column.

CSV to JSON Best Practices

  • Always confirm the delimiter before converting a semicolon- or tab-separated export — a wrong guess collapses every row into one column.
  • Keep a clean header row with unique, code-friendly names; duplicate headers should be de-duplicated automatically so keys do not overwrite each other.
  • Enable auto-typing only when you want numbers and booleans as real JSON types — disable it to keep ZIP codes, IDs, and phone numbers as exact strings.
  • For sensitive data, use a converter that runs entirely in your browser so files are never uploaded to a server.
  • Validate the output JSON against your schema before importing it into a database or API.

JSON to CSV: Going the Other Way

Reversing the conversion flattens an array of objects into rows. The header row is built from the union of every object's keys, so even rows with missing fields line up correctly. Any value that contains the delimiter, a quote, or a newline is automatically wrapped in quotes and escaped, producing a CSV that opens cleanly in Excel, Google Sheets, or a database import. Nested objects and arrays are preserved as compact JSON inside their cell so nothing is silently dropped.

Expert Tips

Keep IDs and ZIP codes as strings

Auto-typing is great for real numbers, but it strips leading zeros from things like ZIP codes, phone numbers, and product IDs. Turn auto-typing off when those columns matter so "01234" stays "01234" instead of becoming 1234.

Confirm the delimiter before you trust the output

If every row collapses into a single column, the delimiter is wrong. European and database exports often use semicolons or tabs — set the delimiter explicitly rather than assuming a comma, and the rows will split correctly.

Frequently Asked Questions

Is this CSV to JSON converter free and private?

Yes. The tool is completely free with no signup, and all conversion happens locally in your browser using JavaScript. Your CSV and JSON never leave your device or get uploaded to a server, which makes it safe for confidential or proprietary data.

How do I handle commas inside CSV values?

Wrap the value in double quotes — for example "London, UK" . The parser treats everything inside the quotes as a single field, so the embedded comma is kept as text rather than read as a column separator. The same applies to values containing newlines.

Why are my numbers showing up as strings in the JSON?

Every CSV value starts as text. Turn on the auto-typing option to convert numeric values to numbers and true / false to booleans. Leave it off when you need to preserve leading zeros in IDs, ZIP codes, or phone numbers.

Can I convert JSON back to CSV?

Yes. Switch the direction to JSON → CSV, paste an array of objects, and the tool builds a header from all keys and writes one row per object. Fields with commas, quotes, or newlines are escaped automatically so the CSV stays valid.

Related guides

Related tools