code: def get_json_body(self, required=None, validators=None):
          
          content_type = self.request.headers.get('Content-Type',
                                                  'application/json')
          if 'application/json' not in content_type.split(';'):
              raise HTTPError(415, 'Content-Type should be application/json')
          if not self.request.body:
              error = 'Request body is empty'
              logging.warning(error)
              raise HTTPError(400, error)
  
          try:
              body = json.loads(self.request.body)
          except (ValueError, TypeError):
              error = 'Error parsing JSON'
              logging.warning(error)
              raise HTTPError(400, error)
  
          if required:
              _check_required(body, required)
  
          if validators:
              _validate(body, validators)
  
          return body
docs: Get JSON from the request body
  
          :param required: optionally provide a list of keys that should be
          in the JSON body (raises a 400 HTTPError if any are missing)
          :param validator: optionally provide a dictionary of items that should
          be in the body with a method that validates the item.
          The method must be synchronous and return a boolean, no exceptions.
          :raises: HTTPError