5. Object Serialization with marshmallow

Learning Objectives

By the end of this chapter, you will be able to:

  • Create a schema for serialization/deserialization
  • Validate the data in a client request
  • Perform data filtering before displaying the data to the client
  • Use the HTTP PATCH method to partially update data

This chapter covers serialization and deserialization, as well as data filtering and validation with marshmallow.

Introduction

In this era of information explosion, the correctness of data is crucially important. We need to ensure that the data passed in by the client is in the format we expect. For example, we expect the cooking time variable to be a data type integer with a value of 30, but the client could pass in a string ...

Get Python API Development Fundamentals now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.