Endianness is the ordering of bytes used to represent a multi-byte value in memory or a serialized representation. CPU architecture determines in-memory byte order, so mismatches can require transformation during serialization and deserialization. section 7.3
A 32-bit value can be arranged in two principal orders:
- Little-endian stores lower-order bits first and higher-order bits last; 0xE011CFD0 becomes 0xD0, 0xCF, 0x11, 0xE0 in memory. section 7.3
- Big-endian stores higher-order bits first and lower-order bits last; 0xE011CFD0 becomes 0xE0, 0x11, 0xCF, 0xD0. section 7.3
Order identifier in memory
A Rust order structure stores orderId 1001 as the four bytes 0xE9, 0x03, 0x00, and 0x00 under little-endian order. Serialization presents the same value as JSON 0x000003E9, while deserialization reverses the transformation. 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.
Compare the in-memory Rust struct with its JSON representation and the reverse deserialization path. section 7.3


