Load and Validate Input Payloads
Deserialize request data with validation rules.
Loading Defined
Going the other way, turning incoming JSON into trusted Python data is called loading. The schema both parses and checks the payload.
Call load
Pass a request dict to the schema's load method. It validates every field and returns clean data, raising an error if something is wrong.
data = user_schema.load(request.get_json())All lessons in this course
- Why Hand-Built JSON Falls Apart
- Define a Schema for a Model
- Dump Objects to JSON
- Load and Validate Input Payloads