Key takeaway
Validate a catalog export and preserve identifier and quantity semantics.
On this page
If a product SKU is 00017, turning it into the number 17 changes the identifier. A blank stock count also means something different from a known quantity of zero. Decide what each column represents before attaching the export to an assistant or loading it into an AI pipeline. Python’s CSV reader handles quoted fields, including commas inside a title. Python CSV documentation
Apply a small data contract
Download the catalog CSV and converter. The example expects three columns in order: SKU, title and quantity. The SKU and title stay as strings. Quantity is a nonnegative integer when present and JSON null when the source cell is empty.
python csv-to-ai-records.py ai-catalog-fixture.csv catalog.jsonl
The November 12, 2026 run produced three records. These two lines show why a typed export is useful:
{"sku": "00017", "title": "Cedar tray, small", "quantity": 0}
{"sku": "00018", "title": "Birch tray", "quantity": null}
The quoted comma stays inside the first title. The leading zeros and the difference between zero and unknown survive. JSONL output from the run
Reject a bad row before writing
Try replacing a quantity with a word or repeating an existing SKU. The converter checks the whole file before opening the output, so a bad row leaves no partial JSONL file. It expects a new output filename, which keeps earlier exports available for comparison. If your source uses a different column order or delimiter, define that contract explicitly before adapting the script.
Before sending a real export to AI, compare the source and result counts and inspect rows that contain unknown values, leading-zero IDs and embedded commas. A spreadsheet may already have converted an ID before exporting. A JSON converter cannot reconstruct zeros that were lost upstream, so check a known SKU against the original system.
Tell the assistant how to interpret the data
Ask a question that distinguishes the two states, such as “Which SKUs are confirmed to have no stock?” In this sample the expected confirmed result is 00017. The Birch tray is unknown and calls for a follow-up. Ask the assistant to cite the SKU it used and check the response against the JSONL. For source data that begins in a PDF, first verify that extraction preserved the numeric column associations. PDF table-to-CSV guide
Sources & references
Written by Modelrovia Editorial. Our standards distinguish official claims from observed results.
How we research and test →

