Python simplejson.JSONDecoder() Examples
The following are 12
code examples of simplejson.JSONDecoder().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
simplejson
, or try the search function
.
Example #1
Source File: managed_datastructures.py From kingpin with Apache License 2.0 | 6 votes |
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)
Example #2
Source File: test_encode_for_html.py From qgis-cartodb with GNU General Public License v2.0 | 5 votes |
def setUp(self): self.decoder = json.JSONDecoder() self.encoder = json.JSONEncoderForHTML()
Example #3
Source File: common.py From daf-recipes with GNU General Public License v3.0 | 5 votes |
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)
Example #4
Source File: json.py From pycopia with Apache License 2.0 | 5 votes |
def GetJSONDecoder(): # decoding: JSON -> native global _DECODER if _DECODER is None: decoder = JSONObjectDecoder() decoder.register("datetime", _DtDecoder) # pre-register datetime objects decoder.register("date", _DateDecoder) # pre-register date objects decoder.register("set", _set_decoder) # pre-register set objects decoder.register("Enum", _enum_decoder) # pre-register Enum objects _DECODER = simplejson.JSONDecoder(object_hook=decoder) return _DECODER
Example #5
Source File: 0015.py From My-Solutions-For-Show-Me-the-Code with Mozilla Public License 2.0 | 5 votes |
def read_file(filename): with open(filename,'r') as fp: content = fp.read() d = json.JSONDecoder().decode(content) return d #生成对应的xls文件
Example #6
Source File: 0014.py From My-Solutions-For-Show-Me-the-Code with Mozilla Public License 2.0 | 5 votes |
def read_file(filename): with open(filename,'r') as fp: content = fp.read() #simplejson这个模块还没细看,怎么解码还是需要了解下 d = json.JSONDecoder().decode(content) return d #生成对应的xls文件
Example #7
Source File: 0016.py From My-Solutions-For-Show-Me-the-Code with Mozilla Public License 2.0 | 5 votes |
def read_file(filename): with open(filename,'r') as fp: content = fp.read() l = json.JSONDecoder().decode(content) return l #生成对应的xls文件
Example #8
Source File: utils.py From vk with MIT License | 5 votes |
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
Example #9
Source File: utils.py From teambition-api with MIT License | 5 votes |
def __init__(self, *args, **kwargs): kwargs['object_hook'] = self.datetime_object_hook super(JSONDecoder, self).__init__(*args, **kwargs)
Example #10
Source File: test_encode_for_html.py From syntheticmass with Apache License 2.0 | 5 votes |
def setUp(self): self.decoder = json.JSONDecoder() self.encoder = json.JSONEncoderForHTML()
Example #11
Source File: test_encode_for_html.py From Tautulli with GNU General Public License v3.0 | 5 votes |
def setUp(self): self.decoder = json.JSONDecoder() self.encoder = json.JSONEncoderForHTML() self.non_ascii_encoder = json.JSONEncoderForHTML(ensure_ascii=False)
Example #12
Source File: riakcs.py From integrations-core with BSD 3-Clause "New" or "Revised" License | 5 votes |
def load_json(cls, text): data = json.loads(text) if "legend" in data: # riak cs before v2.1 had duplicate keys data = json.JSONDecoder(object_pairs_hook=multidict).decode(text) return data