json

FormatValidateConvert

CSV to JSON converter

Source

CSV

Result· read-only

—JSON

The result appears here.

Start over?

This clears the source, the result and the Path.

Convert

CSV to JSON converter.

Your document never leaves the browser.

CSV to JSON with the delimiter and header detected — comma, semicolon, tab or pipe.

Paste or drop a CSV export from any spreadsheet and get an array of objects, with the page saying how it read the file and a choice when the guess is wrong.

4

delimiters tried: comma, semicolon, tab and pipe

50

records read to find the one that fits

0

bytes leave your machine

How the file is read

1

The CSV, separated by semicolons

id;name;city
1;Ada;London
2;Linus;Helsinki
3;Grace;New York
2

The JSON it gives, at the default settings

[
  {
    "id": 1,
    "name": "Ada",
    "city": "London"
  },
  {
    "id": 2,
    "name": "Linus",
    "city": "Helsinki"
  },
  {
    "id": 3,
    "name": "Grace",
    "city": "New York"
  }
]

Reading

The delimiter

The delimiter is found by trying comma, semicolon, tab and pipe on the first 50 records, and keeping the one that gives every row the same number of columns. A sep= first line, as Excel writes it, decides instead.

Reading

The header row

A header row is assumed, unless every non-empty cell in the first row is a number or true/false. With no header the result is an array of arrays; no key names are invented.

Reading

Quoted fields

Quoted fields may hold the delimiter, doubled quotes and line breaks, as RFC 4180 says. Cells are never trimmed.

Reading

BOM and blank lines

A byte-order mark is stripped, and blank lines between records are skipped and counted.

Values

A cell that is exactly a JSON number becomes that number, with its digits copied as written; 007 stays a string, and so does a decimal comma like 1.249,50. true and false become booleans. An empty cell is null, and a quoted empty cell is "". A cell holding a JSON object or array becomes that object or array again. Dotted headers such as address.city stay flat keys.

1

A row with a leading zero, a decimal comma, a boolean and two empty cells

code,price,paid,note,extra
007,"1.249,50",true,,""
2

The JSON it gives, at the default settings

[
  {
    "code": "007",
    "price": "1.249,50",
    "paid": true,
    "note": null,
    "extra": ""
  }
]

Headers, short rows and refusals

A blank header is named column1, column2 and so on, and a repeated one gets _2, _3. A first column headed # whose values count up from 0 — the row numbers our own export writes — is dropped. Each fix is counted in the result. A row shorter than the header is padded with null and counted; a longer one, or a quoted field that never closes, is refused with its line and column. The options column lets you set the delimiter and header yourself, and Auto names what it guessed.

  • a row longer than the header
  • a quoted field that never closes

A row longer than the header

id,name
1,Ada
2,Linus,Helsinki

✕ Line 3, column 9: Row 3 has 3 fields; the header has 2

Private by construction

The conversion runs in your browser, in the same engine the editor uses. The document is never uploaded, never logged and never leaves your machine — there is no server to send it to. Once the page has loaded it keeps working with the connection off.

Going the other way?

FAQ

Frequently asked questions

Didn’t find your answer?Write to us on the contact page →
How do I convert CSV to JSON?

Paste or drop your CSV export to produce JSON records. The page identifies the detected delimiter and header row; use the options to correct either guess.

Can I convert an Excel file to JSON?

No. An .xlsx file cannot be read here. Save the sheet as CSV, or copy its cells and paste them: Excel and Google Sheets supply tab-separated text, which the page detects.

Does CSV become a JSON array or objects?

With column headers, CSV becomes an array of objects using those names as keys. Without headers, it becomes an array of arrays, with no invented key names.

Can it make nested JSON from CSV?

No nesting is inferred from headers: address.city remains a single flat key. A cell containing a JSON object or array does become that nested value.

How is the JSON formatted?

The records are indented at the width chosen in Settings ⚙. Tick the Minify option to have them written on one line instead.

Can I convert the JSON back to CSV?

Yes. Press ⇄ after converting to make the JSON records the source. The reversed pair writes CSV from that JSON.

My file uses semicolons. Do I need to change anything?

No. Excel saves CSV with semicolons wherever the comma is the decimal mark, and the page detects it. If it guesses wrong, choose the delimiter under Options.

What about TSV?

Choose TSV under From, or paste tab-separated text and it is detected. A tab is then always the delimiter.

Will a postcode lose its leading zero?

No. Only text that is exactly a JSON number becomes a number, and 0150 is not one.

Is my CSV uploaded?

No. CSV records are parsed into JSON within your browser, without uploading or logging the file. You can keep converting offline after this page has loaded.

Keyboard shortcuts

Send feedback

Questions, bug reports and feature requests are all welcome. A bug report is easiest to act on with the shape of the document that caused it — never send anything confidential.

Email us

Contact page, in a new tab, so this page stays as it is.

Settings

Indent

The result is written with it — YAML and XML at 2 spaces when it is Tab.

Code text size
14 px

Both panes.

Wrap long lines

Load from a URL

Your browser fetches it directly — the request goes to that site, never to us.