typestar

Serde & JSON

11 steps in 5 sets of Rust.

Serde is the reason serialization in Rust is a derive and not a chore. Deriving first, then the field attributes that handle the gap between your struct names and whatever the JSON actually calls them.

Then shapes: nested structures, enums as tagged unions, collections. And finally custom implementations and what failure looks like, because real input is malformed more often than the examples suggest.

Start this tour

Deriving

Field attributes

Shapes

  • Nested structuresStructs inside vectors inside structs — serde follows the whole tree.
  • Enums and taggingHow an enum crosses the wire: internally tagged, untagged, or as a bare string.

Custom & failure

Encore

  • api_models.rsA complete model set for an API payload: parse, validate, summarize.

The other Rust tours