Convert CSV Test Records Without Losing Leading Zeros
A CSV fixture example showing safe identifier handling and row-width limits.

The CSV ↔ JSON Converter turns tabular test records into JSON objects using the header row as keys. Inspect identifier fields and row-width warnings before copying the result into fixtures: commas and numeric-looking text require different treatment.
A spreadsheet export supplies test IDs and attempt counts. A quick conversion works until an ID that looks like a number loses its leading zero. This tool avoids that specific coercion, but the result still needs a schema check.
A leading zero stays in the ID
Leave Header Row checked and paste:
id,attempts
01001,2
"01001",3
The live JSON result has two objects. Both id values are the string "01001"; attempts becomes the numbers 2 and 3. The converter only coerces an unquoted numeric cell when converting it to a number and back yields the same text. Quoted fields stay strings. That distinction protects ZIP-like IDs while keeping ordinary counts numeric.
Commas inside cells are data
The parser detects comma, tab, pipe, or semicolon from the first record and handles quoted fields containing delimiters or line breaks. RFC 4180 describes why a quoted comma is part of the field rather than a new column. For a fixed export format, select the delimiter explicitly instead of relying on detection from an unusual first row.
Rows with fewer or more cells than the header still produce output, accompanied by a warning. Missing cells become empty strings; extra cells are dropped. The reverse JSON → CSV mode serializes nested arrays and objects as JSON text inside cells and warns, because CSV has no nested object type. Neither direction is a substitute for checking that each fixture row has the required columns and types.
Check a boundary row
Convert a representative export containing a leading-zero ID, a quoted comma, and a row with an empty field. Review the row count, warnings, and the resulting JSON types before saving the file used by tests.
CSV references
- RFC 4180: header and quoted-field conventions.
- CSV ↔ JSON Converter: live coercion and direction controls.