Tutorial :What is a “serialized” object in programming?


I've seen the term "serialized" all over, but never explained. Please explain what that means.


Serialization usually refers to the process of converting an abstract datatype to a stream of bytes (You sometimes serialize to text, XML or CSV or other formats as well. The important thing is that it is a simple format that can be read/written without understanding the abstract objects that the data represents). When saving data to a file, or transmitting over a network, you can't just store a MyClass object, you're only able to store bytes. So you need to take all the data necessary to reconstruct your object, and turn that into a sequence of bytes that can be written to the destination device, and at some later point read back and deserialized, reconstructing your object.


Serialization is the process of taking an object instance and converting it to a format in which it can be transported across a network or persisted to storage (such as a file or database). The serialized format contains the object's state information.

Deserialization is the process of using the serialized state to reconstruct the object from the serialized state to its original state.


real simple explanation, serialization is the act of taking something that is in memory like an instance of a class (object) and transforming into a structure suitable for transport or storage.

A common example is XML serialization for use in web services - I have an instance of a class on the server and need to send it over the web to you, I first serialize it into xml which means to create an xml version of that data in the class, once in xml I can use a transport like HTTP to easily send it.

There are several forms of serialization like XML or JSON.


There are (at least) two entirely different meanings to serialization. One is turning a data structure in memory into a stream of bits, so it can be written to disk and reconstituted later, or transmitted over a network connection and used on another machine, etc.

The other meaning relates to serial vs. parallel execution -- i.e. ensuring that only one thread of execution does something at a time. For example, if you're going to read, modify and write a variable, you need to ensure that one thread completes a read, modify, write sequence before another can start it.


What they said. The word "serial" refers to the fact that the data bytes must be put into some standardized order to be written to a serial storage device, like a file output stream or serial bus. In practice, the raw bytes seldom suffice. For example, a memory address from the program that serializes the data structure may be invalid in the program that reconstructs the object from the stored data. So a protocol is required. There have been many, many standards and implementations over the years. I remember one from the mid 80's called XDR, but it was not the first.


  • You have data in a certain format (e.g. list, map, object, etc.)
  • You want to transport that data (e.g. via an API or function call)
  • The means of transport only supports certain data types (e.g. JSON, XML, etc.)
  • Serialization: You convert your existing data to a supported data type so it can be transported.

The key is that you need to transport data and the means by which you transport only allows certain formats. Your current data format is not allowed so you must "serialize" it. Hence as Mitch answered:

Serialization is the process of taking an object instance and converting it to a format in which it can be transported.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »