The header-row contract
CSV has no built-in notion of objects or keys — it is just rows of text separated by commas. The convention this converter follows is that the first row is a header: each cell in it names a column, and those names become the keys of every object in the output array. A file with N data rows produces an array of N objects, each carrying the same keys in the order the columns appear.
Because keys come from the header, they should be present and ideally unique. If a header cell is empty, the converter falls back to a positional name — a blank second column becomes column_2, a blank fourth becomes column_4 — so no data is silently dropped. Duplicate header names are legal in CSV but collapse in JSON, since an object cannot hold two identical keys, so rename them before converting if both columns matter.
The rectangular contract also means every row should have the same number of fields as the header. Ragged rows — a stray trailing comma here, a missing value there — are where quiet data loss usually creeps in, so it is worth glancing at the key set and object count in the output before you rely on it.