0PricingLogin
Flask Academy · Lesson

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

  1. Query Strings via request.args
  2. Form Fields via request.form
  3. JSON Bodies via request.get_json
  4. Headers, Cookies, and the Client IP
← Back to Flask Academy