CSV conversion needs explicit parsing rules. Decide the delimiter, encoding, header row, quoting behavior, and whether empty fields mean empty strings or nulls. Keep identifiers such as postal codes as strings so leading zeros survive. Reject duplicate headers rather than quietly overwriting a field.
Stream large files where possible and report input, accepted, and rejected row counts. For a bad row, keep its number and a safe reason in a separate output; do not shift columns or discard it silently. Validate the resulting objects against the expected schema before formatting JSON. Test quoted commas, embedded newlines, and a row with one missing column.