当前位置: 首页>>代码示例>>Python>>正文


Python simplejson.JSONDecoder方法代码示例

本文整理汇总了Python中simplejson.JSONDecoder方法的典型用法代码示例。如果您正苦于以下问题:Python simplejson.JSONDecoder方法的具体用法?Python simplejson.JSONDecoder怎么用?Python simplejson.JSONDecoder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在simplejson的用法示例。


在下文中一共展示了simplejson.JSONDecoder方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import simplejson [as 别名]
# 或者: from simplejson import JSONDecoder [as 别名]
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) 
开发者ID:pinterest,项目名称:kingpin,代码行数:20,代码来源:managed_datastructures.py

示例2: setUp

# 需要导入模块: import simplejson [as 别名]
# 或者: from simplejson import JSONDecoder [as 别名]
def setUp(self):
        self.decoder = json.JSONDecoder()
        self.encoder = json.JSONEncoderForHTML() 
开发者ID:gkudos,项目名称:qgis-cartodb,代码行数:5,代码来源:test_encode_for_html.py

示例3: make_connection

# 需要导入模块: import simplejson [as 别名]
# 或者: from simplejson import JSONDecoder [as 别名]
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) 
开发者ID:italia,项目名称:daf-recipes,代码行数:9,代码来源:common.py

示例4: GetJSONDecoder

# 需要导入模块: import simplejson [as 别名]
# 或者: from simplejson import JSONDecoder [as 别名]
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 
开发者ID:kdart,项目名称:pycopia,代码行数:13,代码来源:json.py

示例5: read_file

# 需要导入模块: import simplejson [as 别名]
# 或者: from simplejson import JSONDecoder [as 别名]
def read_file(filename):
    with open(filename,'r') as fp:
        content = fp.read()
    d = json.JSONDecoder().decode(content)
    return d  

#生成对应的xls文件 
开发者ID:starlightme,项目名称:My-Solutions-For-Show-Me-the-Code,代码行数:9,代码来源:0015.py

示例6: read_file

# 需要导入模块: import simplejson [as 别名]
# 或者: from simplejson import JSONDecoder [as 别名]
def read_file(filename):
    with open(filename,'r') as fp:
        content = fp.read()
    #simplejson这个模块还没细看,怎么解码还是需要了解下
    d = json.JSONDecoder().decode(content)
    return d  

#生成对应的xls文件 
开发者ID:starlightme,项目名称:My-Solutions-For-Show-Me-the-Code,代码行数:10,代码来源:0014.py

示例7: read_file

# 需要导入模块: import simplejson [as 别名]
# 或者: from simplejson import JSONDecoder [as 别名]
def read_file(filename):
    with open(filename,'r') as fp:
        content = fp.read()
    l = json.JSONDecoder().decode(content)
    return l 

#生成对应的xls文件 
开发者ID:starlightme,项目名称:My-Solutions-For-Show-Me-the-Code,代码行数:9,代码来源:0016.py

示例8: json_iter_parse

# 需要导入模块: import simplejson [as 别名]
# 或者: from simplejson import JSONDecoder [as 别名]
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 
开发者ID:voronind,项目名称:vk,代码行数:8,代码来源:utils.py

示例9: __init__

# 需要导入模块: import simplejson [as 别名]
# 或者: from simplejson import JSONDecoder [as 别名]
def __init__(self, *args, **kwargs):
        kwargs['object_hook'] = self.datetime_object_hook
        super(JSONDecoder, self).__init__(*args, **kwargs) 
开发者ID:jxtech,项目名称:teambition-api,代码行数:5,代码来源:utils.py

示例10: setUp

# 需要导入模块: import simplejson [as 别名]
# 或者: from simplejson import JSONDecoder [as 别名]
def setUp(self):
        self.decoder = json.JSONDecoder()
        self.encoder = json.JSONEncoderForHTML()
        self.non_ascii_encoder = json.JSONEncoderForHTML(ensure_ascii=False) 
开发者ID:Tautulli,项目名称:Tautulli,代码行数:6,代码来源:test_encode_for_html.py

示例11: load_json

# 需要导入模块: import simplejson [as 别名]
# 或者: from simplejson import JSONDecoder [as 别名]
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 
开发者ID:DataDog,项目名称:integrations-core,代码行数:8,代码来源:riakcs.py


注:本文中的simplejson.JSONDecoder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。