Create JSON object out of the response.
434744
def json(self, **kwargs):
        
        try:
            return super(ScraperResponse, self).json(**kwargs)
        except ValueError as ve:
            raise ParseException(ve)
930489
def get_json(response):
    """"""

    json_field_or_function = getattr(response, 'json', None)
    if callable(json_field_or_function):
        return response.json()
    else:
        return jsonutils.loads(response.content)
988600
def loadJson(self, data):
        """"""
        if not isinstance(data, dict):
            data = json.loads(data)
        self.__dict__.update(data)
        self.inflate() # restore objects from str values
        #if self.ports:  self._gotPorts = True
        return self
186328
public static function fromJson($json)
    {
        $responseData = json_decode($json, true);

        if (! $responseData) {
            return new Response(false, ['invalid-json']);
        }

        if (isset($responseData['success']) && $responseData['success'] == true) {
            return new Response(true);
        }

        if (isset($responseData['error-codes']) && is_array($responseData['error-codes'])) {
            return new Response(false, $responseData['error-codes']);
        }

        return new Response(false);
    }
776687
def json(self, data):
        """"""
        if data is not None:
            self._body = json.dumps(data)
            self.add_header('Content-Type', 'application/json')
1338326
def json_response(data, status=200):
    """"""
    from django.http import JsonResponse
    return JsonResponse(data=data, status=status, safe=isinstance(data, dict))
245503
def object_to_json(obj):
    """"""
    if isinstance(obj, (datetime.datetime, datetime.date, datetime.time)):
        return obj.isoformat()
    return str(obj)
211194
def _create_json(self):
        
        data_json = {
            "name": self.name,
            "description": self.description,
            "autoJoin": self.autoJoin,
            "realm": self.realm,
        }
        return data_json
12150
def json(self):
        """"""
        if self.search_results is None:
            return None

        result = []
        for row in self.search_results['rows']:
            obj = {}
            for index in range(0, len(self.search_results['fields'])):
                obj[self.search_results['fields'][index]] = row[index]
            result.append(obj)

        return result
17344
def _fromJSON(cls, jsonobject):
        
        newInstance = cls(jsonobject[0], jsonobject[1])
        attribDict = {}
        attribDict['dataProcessingRef'] = jsonobject[2]
        attribDict['precursor'] = jsonobject[3]
        attribDict['product'] = jsonobject[4]
        attribDict['params'] = [tuple(param) for param in jsonobject[5]]
        attribDict['attrib'] = jsonobject[6]
        attribDict['arrayInfo'] = dict()
        for arrayType, jsonEntry in viewitems(jsonobject[7]):
            arrayEntry = {'dataProcessingRef': jsonEntry['dataProcessingRef'],
                          'params': [tuple(_) for _ in jsonEntry['params']]
                          }
            attribDict['arrayInfo'][arrayType] = arrayEntry
        for key, value in viewitems(attribDict):
            setattr(newInstance, key, value)
        return newInstance
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,
                )
            )
274079
def extract_data_from_response(self, response, data_key=None):
        """"""
        response_json_data = response.json()
        # Seems to be two types of response, a dict with keys and then lists of data or a flat list data with no key.
        if type(response_json_data) == list:
            # Return the data
            return response_json_data
        elif type(response_json_data) == dict:
            if data_key is None:
                return response_json_data
            else:
                return response_json_data[data_key]
        else:
            raise CanvasAPIError(response)
104603
function getJSON (response) {
  return response.json().then((body) => {
    if (body.status !== 'ok') {
      throw error(response, body.status, body.data[0])
    }
    return body
  })
}
701
def make_json_response(rv):
    
    # Tuple of (response, status, headers)
    rv, status, headers = normalize_response_value(rv)

    # JsonResponse
    if isinstance(rv, JsonResponse):
        return rv

    # Data
    return JsonResponse(rv, status, headers)
230191
def save_to_json(self):
        """"""
        requestvalues = {
            'Dataset': self.dataset,
            'Header' : self._get_item_array(self.header),
            'Filter' : self._get_item_array(self.filter),
            'Stub' : self._get_item_array(self.stub),
            'Frequencies': self.frequencies
        }
        return json.dumps(requestvalues)
217611
def from_json(cls, json):
        ''' 

        '''
        roots_json = json['roots']
        root_ids = roots_json['root_ids']
        references_json = roots_json['references']

        references = instantiate_references_json(references_json)
        initialize_references_json(references_json, references)

        doc = Document()
        for r in root_ids:
            doc.add_root(references[r])

        doc.title = json['title']

        return doc
78657
def to_json(self):
    """"""
    new_pos = self._blob_reader.tell()
    if self._has_iterated:
      new_pos -= 1
    return {self.BLOB_KEY_PARAM: self._blob_key,
            self.INITIAL_POSITION_PARAM: new_pos,
            self.END_POSITION_PARAM: self._end_position}