QamoosTech
Programming FundamentalsText and data formatsIntermediate

Serialization

Pronunciationseer-ee-uh-ly-ZAY-shun

Definition

Serialization turns an object in memory into text or bytes, such as JSON, so it can be saved or sent. Deserialization turns it back into an object.

Where you hear it

In API work, caching, saving data to files, and framework docs, for example serializers in Django REST Framework.

Examples

  • The API serializes the order into JSON before sending it.
  • Deserialization failed because a required field was missing.
  • The cache serializes the user object to JSON before storing it in Redis.

Common mistake

Deserializing data you do not trust with a format that can run code, such as Python's pickle. Prefer a plain format like JSON.

Don't confuse with

Validation, which checks that data is correct. Serialization only changes its form.

Say it at work

  • In a meeting or chatAdd a serializer so the model can be returned as JSON.
  • In an email or ticketKeep the stored format stable, or old data won't deserialize.