📊 CSV ↔ JSON Converter
Convert CSV to JSON and JSON to CSV instantly. Supports headers, custom delimiters, and nested JSON flattening. Free online CSV ↔ JSON converter — no signup needed.
How to Use
Choose direction
Select CSV → JSON to convert a spreadsheet to data, or JSON → CSV to export JSON as a table.
Paste your data
Paste CSV (with header row) or valid JSON array into the input area. The table preview updates live.
Copy or download
Click Copy or Download to save the output. Use the table preview to verify your data looks correct.
Frequently Asked Questions
Complete Guide: CSV to JSON Converter
CSV (Comma-Separated Values) and JSON (JavaScript Object Notation) are two of the most common data interchange formats. CSV is the lingua franca of spreadsheets — exported by Excel, Google Sheets, and virtually every database tool. JSON is the native format for web APIs and JavaScript applications. Converting between them is a daily task for developers, data analysts, and anyone building data pipelines.
The RFC 4180 CSV Specification
Despite its name and simplicity, CSV has surprising edge cases defined by RFC 4180:
- Fields containing commas, double quotes, or line breaks must be enclosed in double quotes.
- Double quotes within a field are escaped by doubling them:
""represents a single". - The first record may optionally be a header row naming the columns.
- Each record must have the same number of fields.
- Line endings should be CRLF (
\r\n) per the spec, though LF-only is widely accepted.
name,age,city
"Smith, John",42,"New York"
"O'Brien, ""Mike""",35,London
Header Row Handling
When a header row is present, converters produce an array of objects, where each row becomes an object keyed by column names:
[
{ "name": "Smith, John", "age": "42", "city": "New York" },
{ "name": "O'Brien, \"Mike\"", "age": "35", "city": "London" }
]
Without headers, or when using the column-array format, the output is an array of arrays:
[["Smith, John", "42", "New York"], ["O'Brien, \"Mike\"", "35", "London"]]
The BOM Character and Excel UTF-8 Issues
Microsoft Excel adds a UTF-8 BOM (Byte Order Mark, EF BB BF in hex, \uFEFF in Unicode) to the beginning of CSV files exported as "CSV UTF-8." This causes the first column header to appear as name instead of name in parsers that don't strip it. Always check for and remove the BOM before processing Excel-sourced CSV files.
Output Format Options
Two primary JSON output structures are useful in different contexts:
- Array of objects — Best for REST APIs, databases, and ORM input. Each object is self-describing. Field order is preserved by convention but not guaranteed in JSON spec.
- Column arrays (also called "columnar" or "records-split") — Best for charting libraries (e.g., Chart.js, D3.js) and analytics. All values for one column are grouped together.
/* Column arrays format */
{
"name": ["Smith, John", "O'Brien"],
"age": ["42", "35"],
"city": ["New York", "London"]
}
Handling Nulls and Empty Cells
CSV has no native null type. Conventions vary: empty string, the literal text NULL, N/A, or - are all used. During conversion, decide whether empty CSV fields become JSON null, an empty string "", or are omitted entirely from the object. Be consistent — mixed null conventions break downstream type checking.
Streaming Large Files
For files exceeding a few hundred megabytes, browser-based conversion is impractical. Use a streaming approach in Node.js:
const { parse } = require('csv-parse');
const fs = require('fs');
fs.createReadStream('large.csv')
.pipe(parse({ columns: true, bom: true }))
.on('data', (row) => console.log(JSON.stringify(row)))
.on('end', () => console.log('Done'));
Python's pandas is another popular alternative: df = pd.read_csv('file.csv'); df.to_json('out.json', orient='records').
- Format and validate your JSON output with the JSON Formatter.
- Compare two JSON outputs side by side with JSON Diff.