CSV to JSON Converter
Convert CSV to JSON, JSON to CSV or CSV to NDJSON in your browser. Choose the delimiter, header row and quoting behaviour.
Loading tool…
How It Works
The converter wraps papaparse, an RFC 4180-compliant CSV parser, and runs three directions entirely in your browser: CSV to JSON, JSON to CSV and CSV to NDJSON. In CSV to JSON, the first row becomes object keys when "first row is a header" is checked (the default); uncheck it and columns are named field1, field2 and onward. Each data row becomes one object, and every value arrives as a string — CSV has no type system, so 30 stays "30".
Quoting follows RFC 4180. A comma or line break inside double quotes remains part of the value, so "Smith, John" is one field rather than two, and multi-line quoted cells survive intact. Windows CRLF line endings and stray blank lines are handled without any preprocessing, and three delimiters are supported: comma, semicolon and tab.
JSON to CSV flattens in the opposite direction. Nested objects become dotted column names — user.email becomes a column literally labeled user.email — and arrays are stored as JSON text inside their cell, so nothing is silently dropped. The generated header row is the union of every key across all rows in first-appearance order, which keeps rows with different keys aligned. CSV to NDJSON writes one compact JSON object per line with no wrapping array, the shape that log pipelines and bulk-import APIs usually expect.
How to convert between CSV and JSON
- Paste your CSV or JSON into the input box.
- Pick the direction: CSV → JSON, JSON → CSV or CSV → NDJSON.
- Set the header option and delimiter — comma, semicolon or tab — for anything that reads CSV.
- Copy the converted output from the panel below the input.
- If quoted fields were involved, spot-check one row: quoted commas and line breaks stay inside their cell.
The three directions
| Direction | Input shape | Output shape |
|---|---|---|
| CSV → JSON | Rows with an optional header line | Array of objects, one per data row |
| JSON → CSV | Array of objects, nesting flattened | Table with dotted column names and CRLF rows |
| CSV → NDJSON | Rows with an optional header line | One compact object per line, LF endings |
Examples
Input
name,age
Alice,30
Bob,25Output
[
{
"name": "Alice",
"age": "30"
},
{
"name": "Bob",
"age": "25"
}
]The header row becomes keys; every data row becomes one object.
Input
name,age
"Smith, John",30Output
[
{
"name": "Smith, John",
"age": "30"
}
]Boundary: a quoted comma stays inside the field instead of splitting the row.
Input
a,b
1,2Output
[
{
"a": "1",
"b": "2"
}
]Boundary: Windows CRLF line endings parse without preprocessing.
Input
name,age (direction: CSV → NDJSON)Output
{"name":"Alice","age":"30"}\n{"name":"Bob","age":"25"}\nNDJSON writes one compact object per line with no wrapping array.
Input
Output
Error: Empty CSV inputBoundary: empty input is an explicit error, not an empty result.
Frequently Asked Questions
- Which conversion directions are supported?
- Three: CSV to JSON, JSON to CSV and CSV to NDJSON. The direction selector switches between them; the header-row and delimiter options apply to any direction that reads CSV.
- Do numbers stay numbers?
- No. CSV is typeless, so every cell arrives as a string: the age 30 becomes "30" in JSON, and it stays "30" if you convert back to CSV. Cast types in your own pipeline after converting if numeric values matter.
- What happens to nested JSON when converting to CSV?
- Nested objects are flattened into dotted column names (user.email becomes a column named user.email), and arrays are written as JSON text inside a single cell, so no data is discarded. The header row is the union of all keys across rows.
- How are quoted commas and embedded line breaks handled?
- Per RFC 4180: a comma or newline inside double quotes belongs to the value. "Smith, John" parses as one field, and a quoted cell spanning two lines stays one record. CRLF and LF files both parse without preparation.
Limitations & Accuracy
All CSV values arrive as strings — no type inference. Nested JSON flattens to dotted columns and arrays are inlined as JSON text. Empty input is an error by design (Empty CSV input / Empty JSON input). JSON-to-CSV output uses CRLF line endings while NDJSON output uses LF. Parsing is papaparse 5.x (RFC 4180); a duplicate header name is suffixed (_2, _3) rather than overwriting the earlier column.