X Xerobit

CSV to JSON Converter

Convert CSV to JSON the correct way — RFC 4180 compliant parser handles quoted fields, escaped quotes, commas in fields, and CRLF line endings. Auto-types numbers and booleans. Supports TSV and semicolon-delimited.

How to convert CSV to JSON — step by step

  1. Paste or type your CSV into the input box. You can paste directly from Excel (Ctrl+C on a selection copies tab-separated values), from Google Sheets, or from any text editor.
  2. Choose your delimiter. The default is comma. If your data is tab-separated (TSV), select Tab. European Excel exports often use semicolon as the delimiter because the comma is reserved as a decimal separator in some locales. Pipe (|) is common in database exports where fields may contain commas.
  3. Toggle "First row is header". When checked, the first row becomes the property names and each subsequent row becomes a JSON object. When unchecked, all rows (including the first) become arrays of values — useful when there is no header row or when you want to process headers programmatically.
  4. Toggle "Auto-type". With auto-typing on, numeric strings like 42 and 3.14 become JSON numbers, true and false become booleans, and empty cells become null. With it off, every value stays a string.
  5. Choose indent. 2-space indent produces readable JSON; minified produces the most compact output for embedding in other formats.
  6. Copy the output. The Copy button puts the JSON on your clipboard, ready to paste into a code file, API client, or another tool.

Why CSV parsing is harder than it looks

CSV looks trivial — comma-separated lines, right? A correct RFC 4180 parser has to handle a surprising number of edge cases that a naive split-on-comma approach gets wrong every time:

This tool uses a proper state-machine parser that handles all of these cases correctly, matching RFC 4180 behavior.

Output formats explained

The tool produces one of two output shapes depending on the header toggle:

Example: a 3-row CSV with headers converts as follows. Input:

id,name,salary,active
1,Alice,95000,true
2,Bob,87500,true
3,Carol,,false

Output with header on and auto-type on:

[
  { "id": 1, "name": "Alice", "salary": 95000, "active": true },
  { "id": 2, "name": "Bob", "salary": 87500, "active": true },
  { "id": 3, "name": "Carol", "salary": null, "active": false }
]

Notice that id and salary become numbers, booleans become JSON booleans, and the empty salary cell for Carol becomes null.

Auto-typing: what gets converted and when

With auto-type enabled, the converter applies these rules to every field value after stripping surrounding whitespace:

Turn auto-type off when you need all values as strings — for example, when preserving leading zeros in zip codes (07030) or product codes that look like numbers.

Supported delimiters

CSV to JSON vs JSON to CSV — when to go which direction

CSV → JSON is the right move when you are loading tabular data into a JavaScript application, a REST API, a document database, or a data visualization library. JSON is natively understood by every modern programming environment.

JSON → CSV is useful when you need to open data in a spreadsheet, import it into a relational database via COPY or LOAD DATA, or hand it to a business analyst. Flat JSON arrays of objects map cleanly to CSV rows; nested structures require flattening first.

Common data sources for this tool

Performance notes

The parser runs entirely in the browser's main thread. Files up to approximately 50 MB parse without noticeable lag on a modern machine. Above that threshold, the UI may become sluggish as the parser builds and serializes a large JSON tree.

For large files, the right tool is a streaming parser. In Python, the built-in csv module reads row-by-row and never loads the entire file into memory. In Node.js, the csv-parse package supports a streaming interface via Transform streams. Both handle files of arbitrary size in constant memory.

FAQ

Does it handle Excel CSV files correctly?

Yes. Excel exports are RFC 4180 compliant: fields containing commas or quotes are quoted, line endings are CRLF, and the file is UTF-8 with an optional BOM. The parser handles all of these automatically. If your Excel file uses a semicolon delimiter (European locale), switch the delimiter selector to semicolon before converting.

Can I convert JSON back to CSV with this tool?

Not currently — this tool is CSV → JSON only. To go the other direction, you can use a spreadsheet: paste your JSON array of objects into a JS console, call Object.keys(arr[0]) for headers, then map values row-by-row. A dedicated JSON → CSV tool is on the roadmap for this site.

What is the maximum file size?

The browser-based parser handles up to approximately 50 MB smoothly. For larger files — database dumps, full analytics exports — use Python's csv module or Node's csv-parse with streaming to avoid loading the entire file into memory. Both support arbitrarily large files and produce identical RFC 4180-compliant output.

Related tools

Related articles

Pillar

Part of Data & Format — JSON, YAML, XML, CSV, SQL, Markdown.


Written by Mian Ali Khalid. Last updated 2026-05-13.