我们从Python开源项目中,提取了以下14个代码示例,用于说明如何使用simplejson.JSONDecoder()。
def __init__(self, list_domain, list_key, list_name, list_description, zk_hosts, aws_keyfile, s3_bucket, s3_endpoint="s3.amazonaws.com", encoder_cls=json.JSONEncoder, decoder_cls=json.JSONDecoder, update_callback=None, force_config_update=None): kwargs = {} if force_config_update is not None: kwargs['force_config_update'] = force_config_update super(ManagedJsonSerializableDataConfig, self).__init__( list_domain, list_key, list_name, list_description, zk_hosts, aws_keyfile, s3_bucket, s3_endpoint=s3_endpoint, **kwargs) self.encoder_cls = encoder_cls self.decoder_cls = decoder_cls self.update_callback = None if update_callback: self.set_update_callback(update_callback)
def setUp(self): self.decoder = json.JSONDecoder() self.encoder = json.JSONEncoderForHTML()
def json_iter_parse(response_text): decoder = json.JSONDecoder(strict=False) idx = 0 while idx < len(response_text): obj, idx = decoder.raw_decode(response_text, idx) yield obj
def __init__(self, **kw): """Constructor for simplejson.JSONDecoder, with defaults overriden for jsonplus. """ _decoder_default_args(kw) super(JSONDecoder, self).__init__(**kw)
def make_connection(decode_dates=True): solr_url, solr_user, solr_password = SolrSettings.get() if decode_dates: decoder = simplejson.JSONDecoder(object_hook=solr_datetime_decoder) return pysolr.Solr(solr_url, decoder=decoder) else: return pysolr.Solr(solr_url)
def initialize(self): self.movie = json.JSONDecoder().decode(self.page)['movie']
def get_searches(self): result = json.JSONDecoder().decode(self.page) try: movies = result['feed']['movie'] for movie in movies: try: title = '' year = '' if 'title' in movie: title = movie['title'] elif 'originalTitle' in movie: title = movie['originalTitle'] if 'productionYear' in movie: year = '(%s)' % movie['productionYear'] self.titles.append('%s %s' % (title, year)) self.ids.append(movie['code']) except: log.exception('') except: log.exception('') log.error(self.page) # # Plugin Test #