Serialization
Learn how to create and use a serializer in Django.
We'll cover the following...
What is serialization?
The front-end framework of our application must understand the complex data types from our model instances to render it correctly. Serialization is the process of converting these complex data types of our model instances and database data into representations of data that our front-end framework can understand and use.
The Django REST framework provides us with this serialization functionality through the serializer
and ModelSerializer
classes. It also provides us with data validation mechanisms that ensure that the stored data types match correctly to what is stipulated in the models. It can convert objects and complex data types into various representations, like JSON
, XML
, etc. These formats facilitate proper storage and transmission of data. ...