Serialization
Serialization in session replay is the conversion of live browser state, primarily the DOM tree, into a plain data structure that can be stored, transmitted, and later rebuilt. It is what turns a rendered page into JSON, and its rules decide what a recording can and cannot faithfully reproduce.
How it works
The serializer visits each DOM node and outputs its type, tag, attributes, and text, assigning a stable numeric id per node. The serialization documentation covers the format and its special cases. Stylesheets get inlined so replay does not depend on external files staying online, form values are captured (or masked) explicitly because they live in element state rather than markup, script contents are dropped, and relative URLs are made absolute. What the serializer skips is a privacy feature as much as a technical one: masked input, for example, is serialized as asterisks and the real value never exists in the recording.
Where you encounter it
At recording start (full snapshot) and inside every mutation event. Serialization choices surface later as replay bugs: a font that renders differently or an image that 404s in replay usually traces back to a serialization rule.