Convert · CSV to JSON

Convert CSV to JSON

Paste CSV rows and get a clean JSON array of objects — with numbers and booleans detected automatically. Runs in your browser.

No sign-up to start · Runs in your browser

CSV to JSON
Open the JSON in the editor
CSV
JSON

Runs entirely in your browser — nothing is uploaded.

id,name,email,active
1,Ada Lovelace,ada@example.com,true
2,Alan Turing,alan@example.com,false
A CSV-to-JSON converter reads spreadsheet rows and returns a JSON array of objects, using the first row as the keys. JSON Copilot parses quoted fields that contain commas, quotes, or newlines, and coerces plain numbers and true/false into their JSON types while keeping leading-zero values like ZIP codes and ids as strings. It runs entirely in your browser — nothing is uploaded — and the result opens in the full editor when you want to format, validate, or explore it.

CSV to JSON: a worked example

CSV in
sku,title,price,in_stock
007,"Widget, Deluxe",19.99,true
042,Bolt,0.5,false
JSON out
[
  {
    "sku": "007",
    "title": "Widget, Deluxe",
    "price": 19.99,
    "in_stock": true
  },
  {
    "sku": "042",
    "title": "Bolt",
    "price": 0.5,
    "in_stock": false
  }
]

The header row supplies the keys. SKU 007 keeps its leading zero as a string, the quoted "Widget, Deluxe" stays one field despite the comma, and 19.99, 0.5, true, and false are detected as numbers and booleans.

How to convert CSV to JSON

  1. 1

    Paste your CSV

    Drop CSV text with a header row into the input, or start from the loaded example. Fields quoted with commas, quotes, or line breaks are read correctly.

  2. 2

    Confirm the header row

    The first line becomes the object keys. Rename ambiguous columns before converting, since empty header cells fall back to column_1, column_2, and so on.

  3. 3

    Convert to JSON

    Each remaining row becomes one object. Plain numbers and true/false are detected, while ids with leading zeros stay strings.

  4. 4

    Scan the result

    Check that types landed the way you expect — a phone number or postal code that must stay a string should still be quoted.

  5. 5

    Open the JSON in the editor

    Send the converted array into the full editor to format, validate, view it as a tree or mind map, or ask the AI copilot about it.

Why use this converter

Runs in your browser

Conversion is 100% client-side, so your CSV never leaves your device and no account is needed.

RFC 4180 quoting

Reads fields wrapped in double quotes that contain commas, doubled "" quotes, or newlines inside a single cell.

Automatic type detection

Numeric and true/false cells become JSON numbers and booleans instead of quoted strings.

Safe id handling

Values with leading zeros — ZIP codes, SKUs, account numbers — are kept as strings so they are not mangled.

Predictable keys

Column order is preserved, and blank header cells get stable column_1, column_2 names so no field is dropped.

Straight to the editor

Push the JSON array into the full editor in one step to format, validate, or visualize it.

The header-row contract

CSV has no built-in notion of objects or keys — it is just rows of text separated by commas. The convention this converter follows is that the first row is a header: each cell in it names a column, and those names become the keys of every object in the output array. A file with N data rows produces an array of N objects, each carrying the same keys in the order the columns appear.

Because keys come from the header, they should be present and ideally unique. If a header cell is empty, the converter falls back to a positional name — a blank second column becomes column_2, a blank fourth becomes column_4 — so no data is silently dropped. Duplicate header names are legal in CSV but collapse in JSON, since an object cannot hold two identical keys, so rename them before converting if both columns matter.

The rectangular contract also means every row should have the same number of fields as the header. Ragged rows — a stray trailing comma here, a missing value there — are where quiet data loss usually creeps in, so it is worth glancing at the key set and object count in the output before you rely on it.

Quoting and escaping under RFC 4180

Plain CSV splits on commas and newlines, which breaks the moment a value contains either. RFC 4180, the closest thing CSV has to a spec, resolves this with double quotes: any field may be wrapped in double quotes, and inside those quotes a comma, a line break, or a quote character loses its special meaning. This converter follows that rule, so "Widget, Deluxe" stays a single field rather than splitting into two columns.

A literal double quote inside a quoted field is written by doubling it. The field "say ""hi""" decodes to say "hi" — the parser treats each "" as one escaped quote and the outer pair as the field delimiters. Newlines behave the same way: text wrapped in quotes can span multiple physical lines and still count as one cell, which is common when a column holds addresses or free-form notes.

Fields that need none of this can be left bare. The safe habit when you generate CSV yourself is to quote any value that could contain a comma, quote, or newline, and to escape embedded quotes by doubling them. Do that and the trip through this converter is lossless — what goes in as one field comes out as one string.

Type detection and when ids stay strings

CSV is untyped — every cell is text on disk. To produce useful JSON, the converter inspects each value and coerces the obvious cases: a cell that is a plain number becomes a JSON number, and true or false becomes a JSON boolean. So 19.99 arrives as the number 19.99 and active as the boolean true, not the strings "19.99" and "true".

The important exception is leading zeros. A value like 007, 042, or a ZIP code such as 02139 is kept as a string, because turning it into a number would strip the zero and change its meaning. The same caution protects account numbers, SKUs, and phone numbers that only make sense with their full digit sequence. Anything that is not cleanly numeric or boolean — dates, emails, mixed alphanumerics — also stays a string.

This behavior is deliberately conservative rather than clever. It will not parse dates into a date type, interpret currency symbols, or assume a column of 0 and 1 means booleans. If you need a value in a type the detector will not infer, convert here first and then adjust it in the editor, where you can see the whole document and reshape it precisely.

Common uses: seed data, fixtures, and spreadsheet imports

The most frequent reason to convert CSV to JSON is to move tabular data into code. A spreadsheet of users, products, or countries becomes an array of objects you can drop into a database seed script, a config file, or a static data module — no manual retyping, and the keys are ready to reference by name.

API work is another fit. Test fixtures and mock responses are easier to maintain as a CSV that a non-developer can edit than as hand-written JSON, so teams keep the source as a spreadsheet and convert on the way in. The same applies to exports from analytics tools, CRMs, or admin panels, which almost always hand you CSV and expect you to reshape it before it is usable.

In each case the JSON is a starting point, not the finished artifact. Open the converted array in the full editor to validate it against a schema, format it consistently, view it as a tree or mind map to check the structure, or ask the AI copilot to rename keys, filter rows, or reshape nested fields before you commit it to your project.

Frequently asked questions

Is the CSV to JSON converter free?

Yes. It runs entirely in your browser with no account and no upload — the CSV is parsed on your own device.

Does the first row have to be a header?

Yes. The first row supplies the object keys, and every row after it becomes one object. If a header cell is blank, it is named by position — column_1, column_2, and so on — so no field is lost.

How does type detection work?

Cells that look like plain numbers become JSON numbers, and true or false become booleans. Everything else stays a string, including values with leading zeros, so ids and codes survive intact.

What about commas or quotes inside a field?

Wrap the field in double quotes. The parser reads commas, line breaks, and doubled "" quotes inside a quoted field without splitting the row, following the RFC 4180 convention.

Will empty cells become null?

No. An empty cell becomes an empty string, and the key is still present on every object, so the shape stays consistent across rows.

Are there formats it will not parse?

It expects comma-separated values with a single header row. Multi-line headers, non-comma delimiters like semicolons or tabs, and files without a header are not handled — reshape those first.

How is this different from JSON to CSV?

This tool goes CSV to JSON, producing an array of objects. JSON to CSV does the reverse, flattening a JSON array into rows and columns. For flat tables the two are inverses, though deeply nested JSON does not round-trip cleanly, since JSON to CSV writes nested values as compact JSON text in a cell.

Where does the converted JSON go?

The result appears in the in-page preview, and you can open it in the full editor to format, validate, view it as a tree or mind map, and use the AI copilot.

Related tools

Convert your CSV to JSON

Open the Editor