Parse JSON response for the beginning url(s) for
        the crawler.
196103
def analyze_url_list(self, response):
        
        response = json.loads(response.text)
        for _, block in response['blocks'].items():
            for attribute in block:
                parsed = urlparse(block[attribute])
                # find urls in the JSON response
                if parsed.scheme and parsed.netloc:
                    yield self.make_requests_from_url(block[attribute])
1011772
def parse_response(response)
      if response.headers['Content-Type'] == "application/json"
        JSON.parse(response.body) rescue nil
      else
        response.body
      end
    end
1151776
private static JSONObject parseRequestJSONObject(final HttpServletRequest request, final HttpServletResponse response) {
        response.setContentType("application/json");

        try {
            BufferedReader reader;
            try {
                reader = request.getReader();
            } catch (final IllegalStateException illegalStateException) {
                reader = new BufferedReader(new InputStreamReader(request.getInputStream()));
            }

            String tmp = IOUtils.toString(reader);
            if (StringUtils.isBlank(tmp)) {
                tmp = "{}";
            } else {
                if (StringUtils.startsWithIgnoreCase(tmp, "%7B%22" /* {" */)) {
                    tmp = URLs.decode(tmp);
                }
            }

            return new JSONObject(tmp);
        } catch (final Exception e) {
            LOGGER.log(Level.ERROR, "Parses request JSON object failed [" + e.getMessage() + "], returns an empty json object");

            return new JSONObject();
        }
    }
255681
def curl
      puts "fetching #{@uri.to_s}".green.on_black
      start_time = Time.now
      begin
        c = @c
        c.url = @uri.to_s
        c.perform
        end_time = Time.now
        case c.response_code
        when 200 then
          page = Page.new(@uri, response_code: c.response_code,
                                response_head: c.header_str,
                                response_body: c.body_str,
                                response_time: ((end_time-start_time)*1000).round,
                                crawled_time: (Time.now.to_f*1000).to_i)
        when 300..307 then
          page = Page.new(@uri, response_code: c.response_code,
                                response_head: c.header_str,
                                response_body: c.body_str,
                                response_time: ((end_time-start_time)*1000).round,
                                redirect_url:  c.redirect_url)
        when 404 then
          page = Page.new(@uri, response_code: c.response_code,
                                response_time: ((end_time-start_time)*1000).round)
        end
      rescue Exception => e
        puts e.inspect
        puts e.backtrace
      end
    end
1003991
def parse_bookmark_json (data):
    """"""
    for entry in data["roots"].values():
        for url, name in parse_bookmark_node(entry):
            yield url, name
504000
def json_parse(self, response):
        
        try:
            data = response.json()
        except ValueError:
            data = {'meta': { 'status': 500, 'msg': 'Server Error'}, 'response': {"error": "Malformed JSON or HTML was returned."}}

        # We only really care about the response if we succeed
        # and the error if we fail
        if 200 <= data['meta']['status'] <= 399:
            return data['response']
        else:
            return data
541250
def json_to_response(self, action=None, json_status=None, success_url=None,
                         json_data=None, **response_kwargs):
        
        data = {
            "status": self.get_status(json_status),
            "action": self.get_action(action),
            "extra_data": self.get_json_data(json_data or {})
        }

        if self.action == AjaxResponseAction.REDIRECT:
            data["action_url"] = success_url or self.get_success_url()
        return JsonResponse(data, **response_kwargs)
1172814
def getJson(cls, url, method='GET', headers={}, data=None, socket=None, timeout=120):
        
        if not 'Content-Type' in headers:
            headers['Content-Type'] = ['application/json']

        body = yield cls().getBody(url, method, headers, data, socket, timeout)

        defer.returnValue(json.loads(body))
1010857
def get(url):
    """"""
    response = urllib.request.urlopen(url)
    data = response.read()
    data = data.decode("utf-8")
    data = json.loads(data)
    return data
134737
def _read_content(self, response: Response, original_url_info: URLInfo):
        ''''''
        data = response.body.read(4096)
        url_info = original_url_info

        try:
            self._robots_txt_pool.load_robots_txt(url_info, data)
        except ValueError:
            _logger.warning(__(
                _('Failed to parse {url} for robots exclusion rules. '
                  'Ignoring.'), url_info.url))
            self._accept_as_blank(url_info)
        else:
            _logger.debug(__('Got a good robots.txt for {0}.',
                             url_info.url))
1244103
def get(self, url, params=dict()):
        
        try:
            res = requests.get(url, headers=self.headers, params=params)
            return json.loads(res.text)
        except Exception as e:
            print(e)
            return "error"
1338887
function getJSON (url) {
  return new Promise((resolve, reject) => {
    var xhr = new XMLHttpRequest();
    xhr.open('get', url, true);
    xhr.onreadystatechange = function() {
      var status;
      var data;
      if (xhr.readyState === 4) { // `DONE`
        status = xhr.status;
        if (status === 200) {
          data = JSON.parse(xhr.responseText);
          resolve(data);
        } else {
          reject(status);
        }
      }
    };
    xhr.send();
  });
}
1001298
def _parse_json(self, response, exactly_one=True):
        
        if not len(response):
            return None
        if exactly_one:
            return self._format_structured_address(response[0])
        else:
            return [self._format_structured_address(c) for c in 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,
                )
            )
331892
def parse(self, response):
        
        yield scrapy.Request(self.helper.url_extractor.get_rss_url(response),
                             callback=self.rss_parse)
200120
def basic_parse(response, buf_size=ijson.backend.BUFSIZE):
        
        lexer = iter(IncrementalJsonParser.lexer(response, buf_size))
        for value in ijson.backend.parse_value(lexer):
            yield value
        try:
            next(lexer)
        except StopIteration:
            pass
        else:
            raise ijson.common.JSONError('Additional data')
1176090
def response(self, url):
        """"""
        
        resp = requests.get(url).content
        return self.parseresponse(resp)