Returns the search results as a list of JSON objects.
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
1304596
def _to_query_json(self):
    
    return {
      'quote': self._quote,
      'fieldDelimiter': self._delimiter,
      'encoding': self._encoding.upper(),
      'skipLeadingRows': self._skip_leading_rows,
      'allowQuotedNewlines': self._allow_quoted_newlines,
      'allowJaggedRows': self._allow_jagged_rows
    }
1223634
def _parse(res, params, n, api, **kwds):
    """"""
    cursor = "cursor" in params
    if not cursor:
        start = params["start"]
    if n == 0:
        return ""
    _json = res.get('search-results', {}).get('entry', [])
    # Download the remaining information in chunks
    while n > 0:
        n -= params["count"]
        if cursor:
            pointer = res['search-results']['cursor'].get('@next')
            params.update({'cursor': pointer})
        else:
            start += params["count"]
            params.update({'start': start})
        res = download(url=URL[api], params=params, accept="json", **kwds).json()
        _json.extend(res.get('search-results', {}).get('entry', []))
    return _json
131941
def json(self):
        """"""
        return json.dumps(OrderedDict([('metadata', self.metadata), ('records', self.records.values())]))
331823
def results(self):
        ""
        if self._results is None:
            results = self._json_struct['results']
            def result_iterator():
                for result in results:
                    datatype = None
                    conversion = None
                    for param in self.parent.parameters:
                        if param['name'] == result['paramName']:
                            datatype = param['datatype']
                    if datatype is None:
                        conversion = str
                    else:
                        conversion = datatype.fromJson
                    dt = result['paramName']
                    val = conversion(result['value'])
                    yield (dt, val)
            self._results = dict(res for res in result_iterator())
        return self._results
1153597
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self,
                   'matching_results') and self.matching_results is not None:
            _dict['matching_results'] = self.matching_results
        if hasattr(self, 'hits') and self.hits is not None:
            _dict['hits'] = [x._to_dict() for x in self.hits]
        return _dict
522001
def _get_result_list(json):
    
    result_list = []

    for item in json:
        if 'wrapperType' in item:
            # Music
            if item['wrapperType'] == 'artist' and item['artistType'] == 'Artist':
                music_artist_result = music_artist.MusicArtist(item)
                result_list.append(music_artist_result)
            elif item['wrapperType'] == 'collection' and item['collectionType'] == 'Album':
                music_album_result = music_album.MusicAlbum(item)
                result_list.append(music_album_result)
            elif item['wrapperType'] == 'track' and item['kind'] == 'song':
                music_track_result = track.Track(item)
                result_list.append(music_track_result)
            elif item['wrapperType'] == 'track' and item['kind'] == 'music-video':
                music_video_result = track.Track(item)
                result_list.append(music_video_result)
            # Movies
            elif item['wrapperType'] == 'artist' and item['artistType'] == 'Movie Artist':
                movie_artist_result = movie_artist.MovieArtist(item)
                result_list.append(movie_artist_result)
            elif item['wrapperType'] == 'track' and item['kind'] == 'feature-movie':
                movie_result = track.Track(item)
                result_list.append(movie_result)
            # Ebook Author
            elif item['wrapperType'] == 'artist' and item['artistType'] == 'Author':
                ebook_artist_result = ebook_artist.EbookArtist(item)
                result_list.append(ebook_artist_result)
            # Tv Shows
            elif item['wrapperType'] == 'collection' and item['collectionType'] == 'TV Season':
                tv_season_result = result_item.ResultItem(item)
                result_list.append(tv_season_result)
            elif item['wrapperType'] == 'track' and item['kind'] == 'tv-episode':
                tv_episode_result = track.Track(item)
                result_list.append(tv_episode_result)
            # Software
            elif item['wrapperType'] == 'software' and item['kind'] == 'software':
                software_result = result_item.ResultItem(item)
                result_list.append(software_result)
            elif item['wrapperType'] == 'software' and item['kind'] == 'mac-software':
                mac_software_result = result_item.ResultItem(item)
                result_list.append(mac_software_result)

        elif 'kind' in item and item['kind'] == 'ebook':
            ebook_result = result_item.ResultItem(item)
            result_list.append(ebook_result)
        else:
            unknown_result = result_item.ResultItem(item)
            result_list.append(unknown_result)

    return result_list
434460
def to_json(self):
        
        endpoints = []
        for endpoint in self.endpoints:
            list_fields = endpoint.fields
            resource_type = endpoint.Meta.resource_type
            table = endpoint.Meta.table

            data = endpoint.to_dict()
            data['fields'] = resource_type.get_type_of_fields(
                list_fields,
                table,
            )
            endpoints.append(data)

        data = {
            'title': self.title,
            'endpoints': sorted(endpoints, key=lambda x: x['name']),
        }

        return json.dumps(data)
550728
def to_json(self):
        '''  '''
        roots = []
        for r in self.roots:
            roots.append(r.to_json())
        return {'roots': roots}
598786
def parse_json(raw_json):
        
        result = json.loads(raw_json)

        if 'results' in result:
            result = result['results']

        return result
972063
def getJson(url):
    """"""
    site = urllib2.urlopen(url, timeout=300)
    return json.load(site)
1184485
def _search(self):
        
        results = []
        for _id in self.doc_dict:
            entry = self.doc_dict[_id]
            if entry.doc is not None:
                results.append(entry.merged_dict)
        return results
97998
def _pull_query_results(resultset):
    '''
    
    '''
    _results = collections.defaultdict(lambda: {})
    for _header, _values in resultset.items():
        _header, _group_tags = _header
        if _group_tags:
            _results[_header][salt.utils.json.dumps(_group_tags)] = [_value for _value in _values]
        else:
            _results[_header] = [_value for _value in _values]
    return dict(sorted(_results.items()))
624056
def to_json(self):
    
    cursor = self._get_cursor()
    cursor_object = False
    if cursor and isinstance(cursor, datastore_query.Cursor):
      cursor = cursor.to_websafe_string()
      cursor_object = True
    return {"key_range": self._key_range.to_json(),
            "query_spec": self._query_spec.to_json(),
            "cursor": cursor,
            "cursor_object": cursor_object}
542388
private static List<JsonObject> getJsonValueAsList(JsonValue value) {
        if (value != null) {
            if (value.getValueType() == ValueType.ARRAY) {
                return value.asJsonArray().getValuesAs(JsonObject.class);

            } else if (value.getValueType() == ValueType.OBJECT) {
                List<JsonObject> ret = new ArrayList<>();
                ret.add(value.asJsonObject());

                return ret;
            }
        }
        return null;
    }
586964
def to_json(self):
        """"""

        j = {}
        for p in self.properties:
            j[p] = getattr(self, p)

        return json.dumps(j)
945315
def _to_json(self):
        
        json_list = [{"Assignment": peak.assignments_list, "Dimensions": peak.chemshifts_list} for peak in self]
        return json.dumps(json_list, sort_keys=True, indent=4)