'If the ``Content-Type`` header is ``application/json``, this
property holds the parsed content of the request body. Only requests
smaller than :attr:`MEMFILE_MAX` are processed to avoid memory
exhaustion. Invalid JSON raises a 400 error response.'

@DictProperty('environ', 'bottle.request.json', read_only=True)
def json(self):

    ctype = self.environ.get('CONTENT_TYPE', '').lower().split(';')[0]
    if (ctype == 'application/json'):
        b = self._get_body_string()
        if (not b):
            return None
        try:
            return json_loads(b)
        except (ValueError, TypeError):
            raise HTTPError(400, 'Invalid    JSON')
    return None
