liveBook · Manning

Deserialization

As explained in Latency

Deserialization is the conversion of a stored or transmitted representation back into in-memory data structures or objects.

Deserialization converts a serialized representation back into an in-memory data structure that application code can access. It commonly follows network transport or storage, such as turning JSON from a REST API request into an order object. section 7.3

Treat deserialization as application work when optimizing latency. The transformation consumes CPU cycles and may require expensive memory copies, so measure where it occurs and avoid redundant format conversions when possible. A service may deserialize JSON for processing, then serialize the same order again for storage or a binary RPC format such as Protocol Buffers. section 7.1 section 7.3

Order data across an API

An order represented in memory as a Rust struct with orderId and quantity arrives as JSON. Deserialization reconstructs the in-memory representation from that JSON; the reverse operation serializes the struct for transport or storage. The example also exposes the byte-level transformation of a 32-bit orderId using little-endian storage. section 7.3

Figure 7.2 Serialization transforms the in-memory representation of data (shown on the left as a Rust struct) to a serialized format such as JSON (shown on the right). Deserialization performs the opposite transformation from a serialized format to an in-memory representation.
Figure 7.4: Serialization transforms in-memory representation to a serialized format such as JSON. Deserialization performs the opposite transformation from serialized format to in-memory representation.

Use the figure to compare the Rust struct, serialized JSON, and opposite-direction deserialization transformation. section 7.3

How Latency covers it

How deep it goes
Explains the transformation, CPU and memory-copy costs, service data flow, and a byte-level Rust example without detailing parser implementation.
Examples
Uses an online-store order moving between a Rust struct, JSON, storage, and binary RPC formats.
What you can do after
Diagnose deserialization as a latency bottleneck by locating its timing, redundant transformations, CPU use, and memory-copy overhead.
How it connects
Connects deserialization with serialization, REST APIs, JSON, memory copies, latency optimization, Rust, and Protocol Buffers.

Also explained in

Compare how 10 books explain deserialization →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Latency. The section links point to the parts of the book it draws on.