Clever Quest Lab Tools

CSV to JSON Converter

2026-10-07

Convert CSV to JSON, or JSON back to CSV, right in your browser. Paste text or open a file: nothing is uploaded and the data never leaves your device. The reader handles quoted fields and line breaks inside fields, detects the delimiter and can turn numbers and booleans into real JSON values.

Input

Direction
Paste or type here, or drop a file onto the box.
The file is read by your browser only. It is not uploaded.

Options

Output

—

The conversion runs locally in your browser. Your data is not uploaded or sent to a server.

Preview

—

The preview shows the first 100 rows. Numbers and booleans are set in a monospace font and null in italics. A row marked with ⚠ has a different number of fields than the header: its missing fields become null and its extra fields get the keys _extra1, _extra2, …

How to use the CSV to JSON converter

  1. Choose the direction: CSV → JSON or JSON → CSV.
  2. Paste your data into the input box, or open a local file with the file button or by dropping it onto the box. A file ending in .json, .ndjson or .jsonl switches the direction to JSON → CSV.
  3. Leave the delimiter on Auto-detect, or pick comma, semicolon, tab or pipe yourself. The status line names the delimiter that was used.
  4. Set the options: whether the first row is a header, whether numbers and booleans are inferred, what an empty field becomes, the output format and the indentation.
  5. Read the status line, the warnings and the preview table, then press Copy or Download.

The result updates while you type. Above about 1 MB of input, press Convert instead; the boxes then show only part of the data, but Copy and Download give the complete result. Files are read as UTF-8 text.

How it works

The CSV reader follows RFC 4180, the document that describes the common CSV format:

Delimiter detection. The tool counts commas, semicolons, tabs and pipes outside quotes in the first 30 non-empty records. The character that appears the same number of times in the most records wins. A tie goes to the higher count, then to the order comma, semicolon, tab, pipe.

Type inference. A field becomes a JSON number only when it is written the way JSON writes numbers (an optional minus sign, digits without a leading zero, an optional fraction and exponent) and turning it into a number and back gives the same value. Everything else stays text:

Field textJSON valueReason
42, -0.5, 1.5042, -0.5, 1.5plain numbers
1e31000exponent notation
007, +5"007", "+5"leading zero, plus sign
1,5, 0x1F, 555-0100textnot JSON numbers
12345678901234567890textwhole numbers outside ±9,007,199,254,740,991 (253 − 1) would be rounded
true, FALSEtrue, falsebooleans, in any letter case
empty fieldnull or ""your choice

A decimal with more digits than a number can hold exactly also stays text. Quotes do not change the type unless you tick Keep quoted fields as text; then a quoted "42" stays text and a quoted empty field stays an empty string. With inference off, every value is text.

Header names become the object keys. An empty name becomes fieldN, where N is the column number, and a repeated name gets a suffix: name, name_2, name_3. Both cases are reported. Without a header row the keys are field1, field2 and so on.

Rows with the wrong number of fields are listed with their line number and marked in the preview. Missing fields become null; extra fields get the keys _extra1, _extra2, … In array-of-arrays output a row keeps exactly the fields it has.

Examples

Example 1 — quoted fields. Press Load example in CSV → JSON mode:

id,name,joined,active,score,notes
007,"Smith, John",2024-03-15,true,91.5,"Said ""hello"""
8,Anna Lee,2023-11-02,FALSE,,"Line 1
Line 2"

The status line reports 2 rows, 6 columns and a comma delimiter. The ID with a leading zero stays text and the empty score becomes null:

[
  {
    "id": "007",
    "name": "Smith, John",
    "joined": "2024-03-15",
    "active": true,
    "score": 91.5,
    "notes": "Said \"hello\""
  },
  {
    "id": 8,
    "name": "Anna Lee",
    "joined": "2023-11-02",
    "active": false,
    "score": null,
    "notes": "Line 1\nLine 2"
  }
]

Example 2 — semicolons. The three lines id;price;ok, 007;1.50;true and 8;;false are detected as semicolon-separated. With minified output the result is [{"id":"007","price":1.5,"ok":true},{"id":8,"price":null,"ok":false}].

Example 3 — uneven rows. The lines a,b, 1,2,3 and 4 give two warnings, “Line 2: 3 fields, expected 2.” and “Line 3: 1 field, expected 2.”, and the minified output [{"a":1,"b":2,"_extra1":3},{"a":4,"b":null}].

Example 4 — JSON to CSV. The input [{"a":1,"b":"x,y"},{"a":2,"c":"he said \"hi\""}] has three different keys, so the CSV gets three columns:

a,b,c
1,"x,y",
2,,"he said ""hi"""

Array of objects, array of arrays or NDJSON?

JSON to CSV: what happens to nested data

For an array of objects the columns are all keys that occur in any object, in the order in which they first appear; an object that lacks a key gets an empty field. An array of arrays is written row by row without a header line. null becomes an empty field. A nested object or array is not spread over several columns: it is written as JSON text in one cell.

A field is put in double quotes when it contains the delimiter, a quote, a line break, or a space at its start or end, and every quote inside it is doubled. Records end with CRLF, as RFC 4180 specifies, or with LF if you choose it.

Frequently asked questions

Why is a value that looks like a number in quotes?

Because it would not survive as a JSON number. Leading zeros (ZIP codes, IDs), a plus sign, a decimal comma, thousands separators and whole numbers beyond ±9,007,199,254,740,991 are kept as text so that no digit is lost. To keep every value as text, turn type inference off.

How do I convert a semicolon- or tab-separated file?

Open it as it is. Auto-detect recognises semicolons, tabs and pipes as well as commas, and the status line shows which one it chose. A decimal comma, as in 1,5, is not a JSON number, so such values stay text.

Why do I get a warning about the number of fields?

A record has more or fewer fields than the header. The usual causes are a delimiter or a line break inside a field that is not quoted. Check the line named in the warning.

How large a file can it convert?

Files up to 50 MB are accepted. In our test a 5 MB file with 50,000 rows converted in about one second on a desktop computer. The practical limit is the memory of your device, because the input and the output are both held in the browser.

Is my data uploaded anywhere?

No. The file is read and converted by your browser, and the page sends nothing to a server. Your settings and the input text (only up to about 100 KB) are saved in this browser's local storage so that they survive a reload; Clear also empties the saved copy of the text you see.

Related tools