What is a CSV to JSON converter?
A CSV to JSON converter maps flat rows and columns into structured JSON. The first CSV row usually becomes the property names, each remaining row becomes an object, and the complete result becomes an array of objects.
This is useful when spreadsheet exports, reports, or test fixtures need to be used in JavaScript, APIs, application data, or automated tests.
How to convert CSV to JSON
- Paste CSV into the input area, open a
.csv,.tsv, or.txtfile, or select Example. - Open Options if you need a specific delimiter, generated column names, value type detection, or another output rule.
- Select Convert, or press Cmd + Enter on macOS and Ctrl + Enter on Windows or Linux.
- Review any row or header warnings, then copy the result or open Download to name and save the JSON file.
The default options use the first row as headers, detect comma, semicolon, Tab, or pipe delimiters, preserve every value as a string, keep empty cells as empty strings, and format JSON with two-space indentation.
CSV to JSON example
Input:
id,name,active001,Alice,true002,Bob,falseDefault output:
[ { "id": "001", "name": "Alice", "active": "true" }, { "id": "002", "name": "Bob", "active": "false" }]Values stay as strings by default, so identifiers such as 001 do not lose leading zeros.
How CSV rows become JSON objects
With First row contains headers enabled, each header becomes a JSON property name. Empty headers are replaced with column1, column2, and similar names. Duplicate headers are made unique with suffixes such as name_2, and the converter reports a warning instead of overwriting data.
When the header option is disabled, every row is treated as data and generated column1, column2, and similar property names are used.
Rows with too few cells receive empty values according to the selected empty-cell rule. Rows with extra cells are retained in generated columns, and a row-specific warning explains the mismatch.
Delimiters and quoted CSV fields
CSV does not always use commas. The converter can automatically detect comma, semicolon, Tab, and pipe delimiters. You can also select one of them or enter a single custom delimiter.
Quoted fields are parsed as CSV rather than split at every comma. This preserves:
- Delimiters inside quoted values.
- Double quotes escaped as
"". - Line breaks inside quoted values.
- Empty fields.
- LF and CRLF line endings.
- UTF-8 byte order marks.
An unclosed quoted field produces an error instead of an incomplete JSON result.
Use the CSV Viewer when you only need to inspect quoted fields and detected columns without converting them.
CSV and JSON compared
| Feature | CSV | JSON |
|---|---|---|
| Structure | Rows and columns | Objects and arrays |
| Nested data | Not represented directly | Supported |
| Value types | Not stored reliably | Strings, numbers, booleans, and null |
| Common use | Spreadsheets, reports, imports | APIs, applications, configuration |
| Typical shape | One flat table | Structured records |
CSV is a good exchange format for tabular data. JSON is usually easier for applications to consume when each row represents one record.
Value types and empty cells
CSV does not carry reliable type metadata. Keeping values as strings is the safest default for postal codes, account IDs, phone numbers, and version numbers.
Enable Detect value types when the source is known to contain JSON-like primitives. It converts standard numbers, true, false, and null, while preserving numbers with leading zeros as strings. It does not guess dates or turn cell text into nested JSON.
Empty cells can become an empty string, become null, or omit the property. Empty strings are the default because they preserve the table’s columns without inventing a type.
Array output and keyed object output
The default array of objects works for most APIs and JavaScript code. Keyed object uses one column as the outer JSON key and removes that column from each value:
{ "001": { "name": "Alice" }}Every selected key must be present and unique. The converter stops with an error rather than silently overwriting a duplicate key.
Use JSON Viewer to inspect the converted records as a tree, JSON Formatter when you need to change indentation later, or JSON Validator after manually editing the result. JSON to CSV handles the reverse conversion.
CSV to JSON FAQ
Does the first CSV row become JSON keys?
Yes, by default. Disable First row contains headers to include the first row as data and generate column1, column2, and similar keys.
Can fields containing commas or line breaks be converted?
Yes. Properly quoted fields can contain the selected delimiter, escaped quotes, and line breaks.
Can semicolon-separated CSV or TSV be converted?
Yes. Auto detection supports commas, semicolons, Tabs, and pipes, and Options also provides manual and custom delimiter choices.
Why are numbers converted to strings?
CSV cannot reliably distinguish a number from an identifier. String output preserves values such as 001. Enable type detection only when numeric and boolean conversion is intended.
What happens when rows have different column counts?
Missing cells follow the selected empty-cell rule. Extra cells are retained in generated columns. The result includes row-specific warnings for each mismatch.
Can CSV be converted to nested JSON?
This converter produces flat records because CSV is a flat table and has no standard rule for mapping dotted headers or repeated rows into nested objects.
How are large CSV files handled?
Inputs over 1 MB run in a browser worker so conversion does not block the page. The processing limit is 50 MB because both the CSV source and generated JSON must fit in browser memory.