From flat to structured
CSV is the oldest data-exchange format on the web. Excel exports CSV, legacy APIs sometimes only accept CSV, and many analysts prefer CSV because it opens instantly in Sheets or Excel. But when that data needs to enter a modern app, a REST API or a Node script, JSON is the native shape. This converter bridges the two with a parser that respects RFC 4180.
Rules the parser respects
- The first row is interpreted as headers (keys of the resulting JSON).
- Values inside double quotes can contain the separator, escaped quotes (
"") and line breaks. - Whitespace at the start or end of a value is preserved (not trimmed).
- Empty rows are ignored.
Automatic type detection
By default, the converter inspects each cell and tries to infer a type:
- Numbers:
42,3.14,-7, scientific (1e6). - Booleans: lowercase
trueandfalse. - Null: exact
null, also empty cells. - Strings: everything else, including ISO date strings.
If your CSV has zip codes starting with zero (05000) or SKU IDs that look numeric but should stay strings, disable type detection. Otherwise leading zeros vanish and integrity breaks.
Use cases
- Loading customer data into an app. Convert the CSV the customer exported into JSON and post directly to your API.
- Migrating from Excel to a CMS. Sheets exports CSV; your CMS expects JSON.
- Browser-side processing in JavaScript. Once converted, you can filter, map and reduce with Array methods without external parsers.
- Posting to a REST endpoint. Many APIs accept POST with JSON — handy to have the format ready before sending.
Common conversion errors
- Wrong separator. Pick comma when your CSV uses semicolon and every row collapses into one column.
- Wrong encoding. CSV in Latin-1 (ISO-8859-1) pasted as UTF-8 mangles accents. Convert the file to UTF-8 first.
- Inconsistent quoting. Hand-built CSVs sometimes mix single and double quotes, confusing the parser.
- Duplicate headers. If two columns share a name, JSON keeps only one (object keys are unique).
Validation tips
After converting, sanity-check: JSON.parse in the console plus console.table() gives an instant tabular view. If types aren't what you expect, toggle the detection flag. A column you expected as number that came out as string usually has non-numeric characters (spaces, currency symbols) the parser detected.