CSV to JSON Converter
Convert CSV data to JSON format. First row is used as keys. Copy or download the result.
Paste comma-separated CSV and click Convert to get a JSON array of objects. The first row is treated as headers, and quoted commas inside fields are preserved.
Values are returned as strings, even when they look like numbers or booleans. For semicolon or tab-separated data, convert the delimiter before pasting.
Good to know before converting CSV
The converter expects a header row, then one row per object. It keeps the column names in order and fills missing cells with empty strings.
Headers become keys
A header called first_name becomes the JSON key for that column.
Types stay as text
The value 42 becomes "42", not a numeric JSON value.
Quoted commas are supported
A field such as "London, UK" stays in one JSON property.
Clean the delimiter first
Semicolon and tab-separated files should be normalised to commas before conversion.
CSV to JSON: Bridging Spreadsheets and APIs
CSV (Comma-Separated Values) is the universal export format, every spreadsheet app, database, and analytics tool can produce one. JSON (JavaScript Object Notation) is the universal API format, every web service and modern application speaks it. Converting between them is one of the most common data tasks in development.
The conversion sounds simple (split on commas, wrap in brackets), but real-world CSVs are messy. Fields can contain commas inside quotes, headers may have spaces, and encoding varies. Full-featured converters also handle line breaks inside quoted fields, though this tool does not.
This tool converts comma-separated CSV to JSON in your browser. The first row becomes the keys, and each subsequent row becomes an object. It handles quoted fields and commas embedded inside quotes. Paste your CSV and get JSON. Multi-line fields and file upload are not supported.
CSV Edge Cases That Break Naive Parsers
| Edge Case | CSV Example | What Happens |
|---|---|---|
| Commas in values | "London, UK",100 | Quotes protect the comma from being a delimiter |
| Quotes in values | "He said ""hello""" | Doubled quotes ("") represent a literal quote |
| Newlines in values | "Line 1\nLine 2",42 | Not supported here: each line is always treated as a separate row. Use PapaParse or Python's csv module for multi-line fields. |
| Empty fields | name,,42 | Empty string between delimiters, not null |
| Different delimiters | name;age;city | Normalise semicolon or tab-separated data to commas before using this page |
| BOM characters | \uFEFF"name","age" | Excel adds invisible BOM bytes, strip them before parsing |
What this means for you: If you write a CSV parser with split(','), quoted commas and doubled quotes will break your output. Use a parser library such as PapaParse for JavaScript or the csv module for Python when you need automated processing.
Worked CSV to JSON Example
Start with a short CSV export where the first row names the columns:
CSV input
name,city,notes Aisha,Manchester,"prefers email" Marcus,Toronto,"VIP, beta user"
JSON output
[
{
"name": "Aisha",
"city": "Manchester",
"notes": "prefers email"
},
{
"name": "Marcus",
"city": "Toronto",
"notes": "VIP, beta user"
}
]The quoted comma in "VIP, beta user" stays inside the notes field. Without quotes, that comma would be read as a delimiter and the row would shift into the wrong columns.
When to Use Each Format
Use CSV when...
You need spreadsheet compatibility, simple flat data, or human-readable exports. CSVs open in Excel/Sheets directly. They're smaller than JSON for tabular data and easy to generate from SQL queries.
Use JSON when...
You need nested data, typed values (numbers, booleans, nulls), or API compatibility. JSON preserves data types that CSV loses, "42" vs 42, true vs "true", null vs empty string.
CSV strengths
Smaller file sizes for flat data. Universal import/export support. Easy to generate and read. Streamable, you can process line by line without loading the whole file.
JSON strengths
Nested structures (objects within objects). Data types preserved. Self-describing (keys travel with values). Native to every programming language. The standard for REST APIs.
Programming Language CSV Parsers
| Language | Library | Quick Usage |
|---|---|---|
| JavaScript | PapaParse | Papa.parse(csv, { header: true }) |
| Python | csv / pandas | pd.read_csv('file.csv') |
| PHP | League\Csv | Reader::createFromPath('file.csv') |
| Ruby | CSV (stdlib) | CSV.parse(data, headers: true) |
| Go | encoding/csv | csv.NewReader(file).ReadAll() |
For repeatable imports and scheduled jobs, use the library for your language so the conversion can be tested, reviewed, and rerun with the same settings.
Related Tools
How to use this tool
Paste your CSV data into the input box, with the first row as column headers
Click Convert to JSON to run the conversion
Copy the JSON output to your clipboard
Common uses
- Converting spreadsheet exports for API consumption
- Transforming CSV datasets into JSON for web apps
- Preparing data for NoSQL database imports
- Converting tabular data for JavaScript projects
Share this tool
Frequently Asked Questions
What CSV format is supported?
How are quoted values handled?
Can I use semicolons or tabs as delimiters?
Does it handle empty fields?
What happens to data types?
Is there a size limit?
Can I convert JSON back to CSV?
How do I handle CSV files from Excel?
Does it preserve the column order?
Is my data sent to a server?
What if my CSV has inconsistent column counts?
How do I convert CSV to JSON in JavaScript?
Results are for general informational purposes only and should be checked before use. They are not professional advice. See our Disclaimer and Terms of Service.