Skip to main content
๐Ÿ“œ WAYPOINT LESSON

Checkpoint โ€” The Catalog Import/Export Engine

โญโญ intermediateโณ 25 min read๐Ÿ“ Lesson 131 of 265

Combine options, converters, and boundary defense into one round-trip-safe catalog service.

The gate (mini-build)

A product catalog exchange โ€” import, export, and transform:

  1. Export(IEnumerable<Product> products) โ†’ camelCase JSON array: [{"name":"bolt","price":0.5},...] (name string, price number).
  2. Import(string json) โ†’ products; tolerant of price as number OR string (via a custom converter); malformed JSON or a missing/empty name โ†’ InvalidOperationException("bad payload").
  3. Merge(string jsonA, string jsonB) โ†’ union by name (first wins), exported as Export would.

Product: record Product(string Name, decimal Price). Input JSON shape: {"products":[{"name":"bolt","price":0.5}]}.