How Does It Work?
- Paste your CSVStraight out of a spreadsheet, an export or a text file. The separator is detected automatically, or you can force comma, semicolon, tab or pipe.
- Choose the shapeAn array of objects uses the first row as keys, which is what most APIs expect. An array of arrays keeps every row as a plain list, header included.
- Copy the JSONIndented for reading or minified for pasting into code. Numbers are converted by default; booleans and nulls are optional.
What Is It Used For?
Naively splitting a CSV line on commas breaks the moment a field contains one — which is constantly, because addresses, names and descriptions all do. The convention, set out in RFC 4180, is that such fields are wrapped in double quotes, and a literal quote inside them is written twice. This parser implements that properly, so "Smith, John" stays a single field and a cell containing a line break does not silently become two rows. European exports that use semicolons, and spreadsheet copy-paste that uses tabs, are handled too.
- Turning a spreadsheet export into JSON for an API or a script.
- Converting data copied straight out of a spreadsheet, which arrives tab-separated.
- Checking that a CSV parses the way you expect before importing it somewhere.
- Reshaping a semicolon-separated European export into standard JSON.
- Preparing seed or fixture data for a test suite.
Examples
| CSV input | Output shape | Result |
|---|---|---|
| name,age / Ada,36 | Array of objects | [{"name":"Ada","age":36}] |
| "Smith, John",Madrid | Array of arrays | [["Smith, John","Madrid"]] |
| a;b / 1;2 | Semicolon detected | [{"a":1,"b":2}] |
| x,y / 1, | Empty cells as null | [{"x":1,"y":null}] |