Reference

Type matrix

What structured clone does to a value. Companion to lesson 2. Normative walk: StructuredSerializeInternal.

Three buckets

Bucket What you get Typical values
Keep Same kind of value, new identity primitives (not symbol), Date, Map, Set, arrays, ArrayBuffer, Blob/File, cycles, Error, undefined keys
Flatten New Object with enumerable own data only class instances (methods + privates gone), getter results snapped to data properties
Throw DataCloneError functions, DOM nodes, symbol values, Promise, WeakMap/WeakSet, Proxy

Walk rules (ordinary objects)

  1. A memory map remembers seen objects — that is how cycles keep identity.
  2. Only enumerable own properties (string keys). Enumerable symbol keys are dropped.
  3. Values are read with [[Get]] — getters run; the result is stored as a data property.
  4. Deserialize builds a new object with Object.prototype. Your class prototype is not walked and not restored.

JSON contrast (same inputs)

Value Structured clone JSON round-trip
Date Keep (Date) ISO string
Map / Set Keep {}
Cycle Keep (same-graph identity) TypeError
Function field Throw Dropped / null
Class instance Flatten to plain object Flatten (and lose more types)
undefined key Keep Key dropped

Clone stays a JavaScript value. A REST body still needs JSON.stringify. Revival still needs a custom serializer.