JSON Bodies via request.get_json
Parse JSON payloads from API clients.
APIs Speak JSON
Modern clients often send a JSON body instead of form fields, so you need a different way to read the payload in Flask.
Call request.get_json
Use request.get_json and Flask parses the raw JSON body into a regular Python dict you can work with directly.
data = request.get_json()All lessons in this course
- Query Strings via request.args
- Form Fields via request.form
- JSON Bodies via request.get_json
- Headers, Cookies, and the Client IP