get the json data response
        :param responses: the json response
        :return the json data without 'root' node
10424
async def handle_json_response(responses):
        
        json_data = {}
        if responses.status != 200:
            err_msg = HttpProcessingError(code=responses.status,
                                          message=await responses.json())
            logging.error("Wallabag: aiohttp error {err_msg}".format(
                err_msg=err_msg))
        else:
            try:
                json_data = responses.json()
            except ClientResponseError as e:
                # sometimes json_data does not return any json() without
                # any error. This is due to the grabbing URL which "rejects"
                # the URL
                logging.error("Wallabag: aiohttp error {code} {message}"
                              .format(code=e.code, message=e.message))
        return await json_data
262863
def _data_from_response(self, resp_body, key=None):
        
        if key:
            data = resp_body.get(key)
        else:
            data = resp_body.get(self.plural_response_key, resp_body)
        # NOTE(ja): some services, such as keystone returns values as list as
        # {"values": [ ... ]} unlike other services which just return the
        # list.
        if isinstance(data, dict):
            try:
                data = data["values"]
            except KeyError:
                pass
        return data
727031
def __respond_with_dict(self, data):
        
        response = {}
        if isinstance(data, list):
            temp_data, data = data, {}
            for key, value in enumerate(temp_data):
                data[key] = value

        data.pop('seq', None)
        for index, item in data.items():
            values = item
            if isinstance(item, list) or isinstance(item, dict):
                values = self.__respond_with_dict(item)

            if isinstance(values, dict) and len(values) == 1:
                (key, values), = values.items()
            response[index] = values

        return response
1094066
def _json(self, response):
        
        if response.status_code == 204:
            return None
        try:
            return response.json()
        except ValueError as e:
            raise ValueError(
                'Exception: %s\n'
                'request: %s, response code: %s, response: %s' % (
                    str(e), response.request.url, response.status_code,
                    response.content,
                )
            )
1137418
def json(self, *,  # type: ignore
             loads: Callable[[Any], Any]=json.loads) -> None:
        
        return loads(self.data)
1180197
def response_to_dict(self):
        
        try:
            return json.loads(self.incidents_data.text)
        except Exception:
            return json.loads(json.dumps(xmltodict.parse(
                self.incidents_data.text)))
988518
def render_to_json_response(self, context, **response_kwargs):
        
        return HttpResponse(
            self.convert_context_to_json(context),
            content_type='application/json',
            **response_kwargs
        )
53290
def get_json_response(self):
        
        self.json_response = self.get_response().json()
        if self.json_response is not None:
            error_code = self.json_response.get("errcode", None)
            self.call_status = True if error_code == 0 else False
        return self.json_response
992644
def _get(self, *args, **kwargs):
        
        response = requests.get(*args, **kwargs)

        response.raise_for_status()

        return response.json()
610756
def data(self):
        
        if self.request.method == 'GET':
            return self.request.GET
        else:
            assert self.request.META['CONTENT_TYPE'].startswith('application/json')
            charset = self.request.encoding or settings.DEFAULT_CHARSET
            return json.loads(self.request.body.decode(charset))
983350
def with_json(self, data=None, **params):
        
        if isinstance(data, (tuple, list)):
            data = dict(data)

        if params:
            # data must be None or able to be a dict
            if isinstance(data, dict):
                data.update(params)
            elif data is None:
                data = params
            else:
                raise ValueError('Data must be None or a dict if used with params, got: %r' % data)

        req = self.with_headers({'Content-Type': 'application/json', 'Accept': 'application/json'})
        if isinstance(data, basestring):
            # Looks like it's already been encoded
            return req.with_body(data)
        else:
            return req.with_body(json.dumps(data))
470590
def parse_response(self, response):
        
        status = response.status_code
        if response.ok:
            data = response.json()
            return HttpResponse(ok=response.ok, status=status, errors=None, data=data)
        else:
            try:
                errors = response.json()
            except ValueError:
                errors = response.content
            return HttpResponse(ok=response.ok, status=status, errors=errors, data=None)
599274
def _json_to_subscription_post_response(response_body):
    
    data = json.loads(response_body)
    response_list = []
    for response_data in data.get("responseList", []):
        response_list.append(SubscriptionPostResponse().from_json(
            data.get('uwNetID'), response_data))

    return response_list
1317318
def _read_response(self, response):
        
        self.name = response['name']
        self.description = response['description']
        self.autoJoin = response['autoJoin']
        self.realm = response['realm']
        self.realmAttributes = response.get('realmAttributes', None)
43064
def get_data(self):
        
        data = graceful_chain_get(self.json, "data")
        if data is None:
            return {}

        data_dict = {}
        for key in data:
            if self.is_yaml(key):
                data_dict[key] = yaml.load(data[key])
            else:
                data_dict[key] = json.loads(data[key])

        return data_dict
1236961
def json_response(self, status=200, data={}, headers={}):
        '''
          
        '''
        mimetype = 'application/json'

        header_dict = {}
        for k, v in headers.items():
            header_dict[k] = v

        return Response(
            json.dumps(data),
            status=status,
            mimetype=mimetype,
            headers=header_dict)
1111825
def get(self, timeout=None):
        
        result = super().get(timeout)
        if result.state != 'SUCCESS':
            raise ResultError(result.data, result.code)
        if result.level != 20:
            raise ResultError('not a json response: %d' % result.level, 406)

        return json.loads(result.data)