CSV to JSON Converter

Free browser-based CSV to JSON converter with automatic type inference — paste CSV, get pretty-printed JSON instantly. No sign-up, no upload; nothing leaves your device.

Updated

Share:
Privacy first: conversion happens entirely in your browser — nothing is uploaded to a server.

Frequently Asked Questions

Does this converter handle commas or quotes inside a CSV field?

Yes. The parser follows RFC 4180 quoting rules: a field wrapped in double quotes can contain commas, quotes, or embedded line breaks, and a literal quote inside it is written as two double quotes (""), which the converter un-escapes automatically. A comma outside quotes is always a column separator, so "Doe, John" parses as a single field containing a comma rather than splitting into two fields — the same rule Excel and Google Sheets use when they export quoted CSV.

What happens if two columns in my CSV have the same header name?

The later column silently overwrites the earlier one. Each row becomes a single JSON object keyed by header name, and JavaScript object keys can't repeat, so if your source file has two columns both labeled "Notes" (common after a spreadsheet merge or export bug), only the second column's values survive in the JSON — the first column's data is dropped without a warning. Rename duplicate headers before pasting if you need to keep both columns.

Can this tool convert CSV files that use semicolons or tabs instead of commas?

This page is comma-only, matching the plain "CSV to JSON" use case most people search for. If your file is semicolon- or tab-delimited — common in European locales where the comma is used as the decimal separator, or in files exported from database tools — use the full CSV/JSON converter, which auto-detects the delimiter or lets you choose comma, semicolon, tab, or pipe explicitly.

What happens if a CSV row has more or fewer fields than the header row?

Rows are matched to headers by position, not by count, and nothing here throws an error. A short row (fewer fields than headers) fills the missing trailing values with null; a long row (more fields than headers) has its extra values silently discarded, since only as many fields as there are headers get read. Ragged CSV — often caused by a stray or missing delimiter partway through a file — won't be flagged, so check row lengths first if exact column alignment matters.

Why does converting CSV to JSON turn my ZIP codes or account numbers into the wrong value?

This happens because the converter infers types from the text pattern of each cell, and a plain digit string like 02138 or 4025 matches the integer pattern regardless of what it's supposed to represent. Once it's treated as a number, parseInt("02138") returns 2138 — the leading zero is gone, because JSON numbers have no concept of "padded" digits the way a string does. CSV itself can't flag a field as "keep this as text": RFC 4180 quoting only controls how commas, quotes, and line breaks are escaped, not the data type of what's inside the quotes, so a quoted "02138" and an unquoted 02138 parse identically. If you're converting ZIP codes, phone numbers, SKUs, or account numbers, use the full CSV/JSON converter tool and switch off type inference so every column is preserved as a string, then re-add typing selectively where you actually want numbers.

What's a practical example of when you'd need to convert CSV to JSON?

The most common case is moving a spreadsheet export into something that only speaks JSON. A marketing team exports a CSV of leads from a CRM and needs to POST them to a webhook or a Zapier/Make automation that expects a JSON body. A backend developer has a CSV of product data from a vendor and needs to bulk-insert it into MongoDB or Firestore, both of which store JSON-like documents rather than rows and columns. A QA engineer takes a spreadsheet of test cases and turns it into a JSON fixture file consumed by a test runner. In each case the source of truth is tabular (a spreadsheet, a database export, a CRM download), but the destination — an API, a document store, a test harness — only accepts JSON, so a fast, accurate one-off conversion saves writing a parser for a task done once or twice a month.

Is CSV actually a standardized format, or does every tool export it slightly differently?

CSV predates any formal specification by decades — spreadsheet and mainframe tools were writing comma-delimited text files since the 1970s, each with its own quirks around quoting and line endings. RFC 4180, published by Y. Shafranovich in 2005, documents the common conventions (CRLF line endings, optional double-quote wrapping, doubled quotes for escaping) but is explicitly informational, not a binding standard. In practice, "CSV" still varies: Excel in some European locales exports semicolon-delimited files because the comma is the decimal separator there, some tools use bare LF instead of CRLF, and BOM-prefixed UTF-8 is common from Windows exports. JSON, by contrast, has genuine standards behind it — ECMA-404 and RFC 8259 — which is part of why it parses identically everywhere and CSV parsers still have to guess at dialect.

Is it true that a CSV file always converts into the same structure of JSON, numbers included?

No — this is a common misconception. CSV rows and columns only ever produce a flat JSON array of flat objects; there's no way to express nesting in CSV, so this converter (or any CSV-to-JSON tool) can't output nested objects or arrays no matter how the data is organized. The type of each value isn't fixed either: because CSV stores everything as text, "42" could mean the number 42 or the string "42" depending on context, and different tools infer types with different rules. This converter's rules (true/false for booleans, digit patterns for numbers, empty/null/n-a for null) are one reasonable set of defaults, not a guarantee that matches every other CSV parser you might compare output against, including spreadsheet software's own CSV import.

What happens if my CSV file has a blank header cell or headers with unusual characters?

The header row supplies the JSON key names directly, character for character, including spaces, punctuation, or emoji if your source file has them — JSON keys are just strings, so almost anything is valid. The one exception is a completely blank header cell: rather than produce a key with no name, the converter falls back to a placeholder like column1, column2, matching the cell's position in the row, so every value still ends up somewhere in the output object, just under a generic name instead of the missing label. If you want cleaner, code-friendly key names — no spaces, consistent casing, no special characters that would need bracket notation in JavaScript — it's worth renaming the header row in your source spreadsheet before pasting, since the converter maps headers as-is rather than normalizing or sanitizing them for you.

Embed This Tool

Add a free, live version of this widget to your own website or blog post — it runs entirely in your visitors' browsers, with a credit link back to The Toolbox.

Copy & paste this HTML
<iframe src="https://getthetoolbox.com/embed/csv-to-json" title="CSV to JSON Converter — The Toolbox" width="100%" height="420" style="max-width:480px;border:1px solid #e2e8f0;border-radius:12px" loading="lazy"></iframe>
<p style="font-size:12px;margin:4px 0 0"><a href="https://getthetoolbox.com/converter-tools/csv-to-json?utm_source=embed&utm_medium=widget" target="_blank" rel="noopener">Free CSV to JSON Converter</a> by The Toolbox</p>

About the CSV to JSON Converter

Paste a CSV file into the left pane and the CSV to JSON Converter turns it into a properly-typed JSON array on the right, updating with every keystroke. It runs entirely client-side in your browser — nothing is uploaded, so a spreadsheet export full of customer emails, order IDs, or internal system names never touches a server. Copy the result or download it as converted.json, and jump to the JSON to CSV converter if you need to go the other direction.

Why CSV needs interpretation, not just reformatting

CSV (comma-separated values) has no native type system — every field, whether it looks like a number, a date, or a boolean, is stored as plain text. The closest thing CSV has to a formal specification is RFC 4180 (2005), which defines how fields are separated and how special characters are escaped: a field containing a comma, a double quote, or a line break must be wrapped in double quotes, and a literal double quote inside a quoted field is written as two double quotes (""). The field "Smith, ""Bob"" Robert" decodes to the literal text Smith, "Bob" Robert. JSON, by contrast, has a real (if small) type system — strings, numbers, booleans, null, objects, and arrays — so converting CSV to JSON means deciding, cell by cell, what type each piece of text actually represents.

How this converter makes that decision

The first row is always treated as the header row, and each row after it becomes one JSON object keyed by those headers. For every cell, the converter checks, in order: empty, null, or n/a (case-insensitive) becomes JSON null; true/false (case-insensitive) becomes a JSON boolean; a bare integer like 42 or -7 becomes a JSON number; a decimal like 3.14, .5, or 1.2e10 becomes a JSON number; anything else stays a JSON string. So the input name,age,active,notes followed by Alice,30,true,N/A becomes:

[
  { "name": "Alice", "age": 30, "active": true, "notes": null }
]

Where this gets ambiguous

Because the inference is pattern-based, it can't know intent. A ZIP code like 02138 or an account number stored as plain digits matches the integer pattern and gets converted to a number, silently dropping the leading zero — parseInt("02138") is 2138. A "yes/no" column isn't recognized as boolean, since only the literal words true/false trigger that rule, so it stays text. And if a header cell is blank, the tool falls back to column1, column2, and so on rather than emitting an empty key.

Output and related tools

The resulting JSON is always pretty-printed with 2-space indentation. This page assumes comma-delimited input; if your source file uses semicolons, tabs, or pipes, or you want to turn type inference off entirely and keep every value as a string, the full CSV/JSON converter tool supports delimiter auto-detection and a raw-string mode alongside this simpler paste-and-go version.

Why convert CSV to JSON

Spreadsheet and database exports are almost always CSV, but most APIs, NoSQL databases, and JavaScript tooling expect JSON. This converter removes the manual step of hand-writing a parser for a one-off import, building a test payload for a webhook, or seeding a document database from a CSV a colleague just handed you.