Convert CSV to JSON
Once you have the JSON, paste it in the tool to validate and pretty-print it. Below is the exact method for mapping a CSV's header and rows into a clean array of objects.
The shape you want
A CSV with a header row maps cleanly to a JSON array of objects: the header names become the keys, and each data row becomes one object. Two data rows produce a two-element array.
Commas and quotes
The trap is commas inside a field. In CSV, a value containing a comma is wrapped in double quotes — "Smith, John" is one field, not two. A naive split on commas will corrupt those rows, so respect the quoting rules or use a real CSV parser.
Types
CSV has no types — everything is text. Decide deliberately whether 36 should become the number 36 or the string "36". Leading-zero codes like 007 and phone numbers should stay strings, or you will silently drop the zeros.
FAQ
What if my CSV has no header row?
Then you cannot name the keys. Either add a header, or convert each row to an array of values instead of an object.
How are empty cells handled?
An empty field usually becomes an empty string. Convert it to null only if your consumer expects null for missing values.
Does the column order matter in JSON?
No. Object keys are unordered in JSON, so consumers should read by key name, not position.