What is serialization?

Asked 06-Dec-2019
Viewed 449 times

1 Answer


The process of transforming an item into a stream of bytes in order to store or transport it to memory, a database, or a file is known as serialization. Its major purpose is to save the state of an object so that it can be recreated later. Deserialization is the opposite of serialization.

The data is serialized from the object into a stream. Information concerning the object's kind, such as version, culture, and assembly name, may also be included in the stream. The item can be stored in a database, a file, or memory using that stream.

Serialization allows a developer to save an object's state and re-create it as needed, allowing for both object storage and data transmission.

A developer can use serialization to execute tasks like:

  • Using a web service to send the object to a distant application
  • Object transfer from one domain to another
  • Using a JSON or XML string to pass an object via a firewall
  • Keeping security or user-specific data consistent across applications

In computing, serialisation or serialization is the process of transforming a data structure or object state into a format that can be saved (e.g., in a file or RAM data buffer) or communicated (e.g., over a computer network) and then rebuilt in a new computer environment.

When the resulting series of bits is reread using the serialization format, a semantically identical clone of the original object can be created. This technique is not straightforward for many sophisticated objects, such as ones that use a lot of references. Serialization of object-oriented objects does not include any of the methods that were previously connected with them.

In some cases, serializing an item is also referred to as marshaling an object. Deserialization, on the other hand, extracts a data structure from a series of bytes (also called unserialization or unmarshalling).