liveBook · Manning

Serialization

As explained in Troubleshooting Java, Second Edition

Serialization is the process of transforming structured in-memory data into a transferable or storable byte representation.

Serialization transforms complex in-memory objects into bytes that services can send over a network or store, then reconstructs structured data through deserialization. section 12.2

In distributed systems, serialization is a contract boundary. Small schema changes can cause dropped fields, default values, or deserialization errors instead of immediate failures. section 12.0 section 12.2

Investigate serialization problems by asking:

  • Did one service add or rename a field, change an enum, or alter optionality? section 12.2
  • Could an older model silently ignore new data, substitute default values, or reject the payload? section 12.2
  • Can forward and backward compatibility let services evolve independently? section 12.2
message Order {
  int64 id = 1;
  string customer_id = 2;
  repeated string items = 3;
  optional string notes = 4;
}

A Protobuf schema defines typed fields and field numbers, including repeated and optional values, from which Java serialization and deserialization classes can be generated. section 12.2

How Troubleshooting Java, Second Edition covers it

How deep it goes
Explains byte conversion, mismatch symptoms, schema evolution, and compatibility, then applies them to a Protobuf schema.
Examples
Uses changed JSON fields, renamed Protobuf enums, Java serialVersionUID differences, and an Order Protobuf schema.
What you can do after
Diagnose silent data loss, default values, and deserialization errors while evaluating contract changes for compatibility.
How it connects
Connects serialization with deserialization, versioning, REST, gRPC, messaging, Protobuf, JSON, XML, and compatibility.

Also explained in

Compare how 24 books explain serialization →

Related concepts

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