Tools

CSV → JSON

Convert CSV data to a JSON array. The first row is used as the header.

CSV
Ln:1 Col:1
JSON

About CSV to JSON Conversion

Converting CSV to JSON is a fundamental data processing operation in modern web development and data engineering. Common scenarios include loading CSV datasets into JavaScript applications, transforming spreadsheet exports for REST API consumption, migrating tabular data to NoSQL databases (MongoDB, Firestore), and pre-processing data for visualization libraries like D3.js or Chart.js.

CSV Format Reference

CSV files exported from different tools often have subtle variations: Excel adds a UTF-8 BOM (byte order mark), uses semicolons as delimiters in European locales, and may quote all fields. Google Sheets always uses commas and UTF-8 without BOM. Database exports (MySQL, PostgreSQL) follow RFC 4180 more strictly.

Type inference during CSV-to-JSON conversion requires careful handling: numeric strings (phone numbers, ZIP codes, IDs with leading zeros) may be incorrectly converted to numbers, losing the leading zeros. Dates in various formats (MM/DD/YYYY vs ISO 8601) remain as strings unless explicitly parsed. Empty cells can represent either empty strings or null values depending on context. This tool converts empty cells to null, numbers and booleans to their native JSON types, and everything else to strings.

FAQ

What happens if the CSV has no header row?
Typically the first row is used as headers (keys). Without headers, indices (0, 1, 2...) become keys or data is converted to an array of arrays. This tool treats the first row as headers.
Why are numbers converted as strings?
CSV has no type information — all values are read as strings. Auto type inference can cause issues like "001" becoming number 1. Many tools keep values as strings by default to avoid data loss.
Can TSV (tab-separated) files also be converted?
This tool processes comma-delimited CSV by default. To convert TSV, replace tabs with commas before input, or use a dedicated TSV converter.