Understanding serialization
If you have a complicated data structure, its representation in memory might ordinarily be scattered throughout memory.  (Think of a binary tree, for instance.)

In contrast, when you want to write it to disk, you probably want to have a representation as a (hopefully short) sequence of contiguous bytes.  That's what serialization does for you.