Free CSV to JSON Converter
Paste CSV or TSV and get clean, structured JSON instantly. Auto-detects the delimiter, infers numbers and booleans, handles quoted fields — all in your browser.
Input CSV
JSON Output
What Is CSV to JSON Conversion?
CSV (Comma-Separated Values) is a flat, two-dimensional format — rows and columns, nothing more. JSON (JavaScript Object Notation) is a hierarchical format that can represent nested structures, arrays, and rich types like numbers and booleans.
Converting CSV to JSON is a standard step when moving data between worlds: from a spreadsheet into a web application, from a database export into an API, from an analytics tool into a modern frontend.
The basic shape
Each CSV row becomes a JSON object. Each column header becomes an object key:
name,age,city Alice,30,New York Bob,25,London
Becomes:
[
{ "name": "Alice", "age": 30, "city": "New York" },
{ "name": "Bob", "age": 25, "city": "London" }
]
Note that 30 and 25 are JSON numbers, not strings — the type inference detected them automatically.
RFC 4180 — the CSV standard
CSV looks trivial until you hit real data. The RFC 4180 standard defines the rules that make it parseable:
| Rule | Example |
|---|---|
| Fields containing the delimiter are wrapped in quotes | "Hello, world" |
| Fields containing quotes double the internal quotes | "He said ""hi""" |
| Fields containing newlines are wrapped in quotes | "Line 1\nLine 2" |
| Line endings may be CRLF (Windows) or LF (Unix) | Both accepted |
| A trailing empty field is preserved | a,b, = 3 fields |
The parser in this tool implements the full standard. It does not use regex or naive `split(',')` — it walks the input character by character, tracking whether it's inside a quoted field, handling escapes, and correctly distinguishing a delimiter inside a quote from a delimiter outside one.
Delimiter auto-detection
CSV files come in several flavours:
| Delimiter | Common in |
|---|---|
| Comma ( , ) | US/UK Excel, Google Sheets, standard CSV |
| Semicolon ( ; ) | European Excel (Germany, France, Spain, Italy) |
| Tab ( ⇥ ) | TSV, database exports, log files |
| Pipe ( | ) | Data containing both commas and semicolons |
The auto-detector tries each candidate on the first few lines, counts how consistently it produces the same number of columns, and picks the best. If it's wrong, you can override manually.
Type inference — number, boolean, null
CSV stores every value as a string. But "30" and 30 are meaningfully different in JSON — the first is a text value, the second is a number you can do arithmetic on. Type inference converts cells that clearly look like JSON types:
| Cell value | Converted to |
|---|---|
true / false | boolean |
null | null |
0, 42, -17 | integer |
3.14, -0.5 | float |
1e10, 2.5e-3 | scientific notation |
007 | string (leading zeros preserved) |
1,000 | string (ambiguous — thousands separator?) |
hello | string |
The rules are conservative: only unambiguous matches are converted. Anything ambiguous — leading zeros, thousands separators, trailing dots — stays as a string. You can turn off type inference entirely if you need every cell as a string.
Array of objects vs array of arrays
Two output shapes are common, and different consumers want different ones:
// Array of objects — the standard for APIs and databases
[
{ "name": "Alice", "age": 30 },
{ "name": "Bob", "age": 25 }
]
// Array of arrays — preserves the raw tabular shape
[
["name", "age"],
["Alice", 30],
["Bob", 25]
]
Array of objects is what nearly every API and database expects. Array of arrays is useful when column names are unknown, when you're feeding data into a spreadsheet engine, or when you want the smallest possible JSON output.
Common use cases
Import into Databases
Convert spreadsheet exports to JSON before importing into MongoDB or Firebase.
Seed Data
Turn CSV of test data into JSON fixtures for unit tests.
Charting Libraries
Feed CSV data into D3, Chart.js or Recharts which prefer JSON.
API Payloads
Convert spreadsheet data into JSON for POST requests.
Data Migration
Move records between systems that speak different formats.
Team Handoffs
Give developers data from non-technical teams in a format they can use.
Automation
Parse CSV inputs in serverless functions and Node scripts.
Config Files
Convert CSV lists into JSON config for static site generators.
Handling edge cases
- Duplicate headers. A second column called
namebecomesname_2, a third becomesname_3. Empty headers becomecol_1,col_2by position. - Ragged rows. Rows with fewer cells than headers get empty strings for the missing values. Rows with more get generic
col_Nkeys in object mode. - Trailing newline. Ignored — no spurious empty record at the end of the file.
- BOM. A leading UTF-8 byte-order mark is stripped automatically.
- No header row. Turn off "First row is header" to generate generic
col_1,col_2keys.
Privacy and security
This CSV to JSON converter runs entirely in your browser. Parsing, type inference, JSON serialisation and download all happen locally. Your CSV never leaves your device — safe for customer records, financial data, internal exports and any other sensitive content.
Frequently Asked Questions
What is CSV to JSON conversion?
What is the difference between CSV and JSON?
How are quoted fields handled?
"Hello, world" is correctly parsed as a single field even though it contains a comma.How does delimiter auto-detection work?
What does type inference do?
true or false become JSON booleans, and cells that are exactly null become JSON null. Cells that don't match any of these stay as strings. This produces cleaner JSON that's ready to use in code without string-to-number conversions.What is the difference between array of objects and array of arrays?
[{"name":"Alice","age":30},…]. Array of arrays preserves the raw tabular shape: [["name","age"],["Alice",30],…]. Array of objects is what most APIs and databases want; array of arrays is useful for compact datasets or when column names are unknown.Why is my CSV not converting correctly?
How are duplicate column names handled?
name becomes name_2, a third becomes name_3, and so on. Empty headers are filled with col_1, col_2 based on their position. This ensures every key in the resulting JSON is unique.