Developer Tools

CSV to JSON Converter

Bidirectional CSV ↔ JSON. Auto-detect delimiter, header row, type conversion. 100% browser-only.

CSV vs JSON — when each makes sense

CSV (Comma-Separated Values) is the lowest-common-denominator tabular format. Every spreadsheet, database, and analytics tool reads and writes it. It's compact, line-oriented, easy to grep — but lacks types, hierarchy, and nested structure.

JSON (JavaScript Object Notation) is the modern API format. It supports nested objects, arrays, types (string, number, boolean, null), and is the default for REST APIs and JavaScript ecosystems. More verbose than CSV but more expressive.

Convert when you need to bridge: pulling a CSV export from a tool and feeding it into a JSON-based API, or exporting a JSON dataset to import into Excel.

How CSV parsing actually works

A naive CSV parser splits on commas. That breaks the moment any cell contains a comma — which is constant in real data (addresses, decimal numbers in some locales, descriptive text). Real CSV uses quoting:

  • Cells containing commas, quotes, or newlines are wrapped in double quotes.
  • Quotes inside quoted cells are escaped by doubling: "She said ""hi""".
  • Newlines inside quoted cells are part of the cell, not a row separator.
  • RFC 4180 codifies these rules; most tools follow it loosely.

Our parser handles all three. If you see weird output, the input probably uses non-standard escaping (single quotes, escaped commas with backslash, etc.) — those need preprocessing.

Common CSV gotchas

  • UTF-8 BOM: Excel sometimes adds  at the start. The first column header may look like name with an invisible character. Strip it before parsing.
  • Line endings: Windows uses CRLF (\r\n), Unix uses LF (\n), old Mac uses CR (\r). Our parser handles all three.
  • Locale delimiters: European locales often use semicolons because comma is the decimal separator. Auto-detect handles this.
  • Empty cells vs null: a missing value in CSV is just empty (,,). JSON can distinguish empty string from null. With type conversion on, empty cells become null.
  • Leading zeros: phone numbers, ZIP codes, IDs that start with zero get mangled if you convert to number. Toggle type conversion off when these are present.

JSON for tabular data — array of objects

The most common JSON shape for tabular data is an array of flat objects with consistent keys: [{a:1,b:2},{a:3,b:4}]. This maps cleanly to CSV rows. Some APIs use a different shape — {rows:[...], columns:[...]} — which needs a transformation step before this converter can handle it.

When to use programmatic alternatives

For one-off conversions or quick sanity checks, this tool is perfect. For repeated/scripted work or large files:

  • jq: command-line JSON processor. Pair with csvtojson for the bridge.
  • csvkit: csvjson command does this exact conversion at scale.
  • pandas (Python): pd.read_csv().to_json() for full-power data manipulation.
  • papaparse / d3-dsv (JavaScript): production-quality CSV libraries.

Privacy: your data stays in your browser

All conversion happens client-side. No upload, no logging. Safe for sensitive data — internal customer lists, financial exports, anything you wouldn't paste into a third-party site. Verify by checking your browser's network tab while using the tool.

For other developer utilities: JSON Formatter for pretty-printing/validation, Base64 Encoder/Decoder, and URL Encoder/Decoder.

Frequently Asked Questions

How does this convert CSV to JSON?
It parses your CSV (handling quoted strings, escaped quotes, and multi-line cells), then maps each row to a JSON object using the first row as keys (if header is enabled). Numeric strings are auto-converted to numbers when "Convert numbers" is on. Empty cells become null.
What if my CSV has commas in the data?
Standard CSV escapes data containing commas with double quotes: `"Hello, World"`. Quotes within quoted strings are escaped by doubling: `"He said ""hi"""`. The parser handles both cases. If your data uses tabs or semicolons instead of commas, switch the delimiter or use auto-detect.
Does this work with large files?
Up to ~10MB works fine in most browsers. For larger files (CSV exports of millions of rows), use command-line tools like csvkit, jq, or pandas — browser-based processing isn't designed for big-data workloads.
Will my data be uploaded anywhere?
No. Everything runs in your browser. Your CSV/JSON is parsed locally and never sent to any server. Safe for sensitive data — internal exports, customer lists, financial data.
What's the difference between CSV and TSV?
CSV uses commas as field separators; TSV uses tabs. TSV is preferred when data contains commas (less escaping needed). Most database export tools support both. Switch the delimiter in the calculator to handle TSV.

Related Calculators