'Return the body of the request as JSON data.'

def get_json_body(self):

    if (not self.request.body):
        return None
    body = self.request.body.strip().decode('utf-8')
    try:
        model = json.loads(body)
    except Exception:
        self.log.debug('Bad    JSON:    %r', body)
        self.log.error("Couldn't    parse    JSON", exc_info=True)
        raise web.HTTPError(400, 'Invalid    JSON    in    body    of    request')
    return model
