节俭与json的转换
thrift_json的Python项目详细描述
节约json
节俭与json之间的转换
- 自由软件:麻省理工学院许可证
使用量
从json/dict转换为thrift
>>> from thrift_json import json2thrift, dict2thrift >>> thrift_obj = json2thrift(json_str, thrift_class) >>> thrift_obj = dict2thrift(dict_obj, thrift_class)
从节俭到json/dict的转换
>>> from thrift_json import thrift2json, thrift2dict >>> json_str = thrfit2json(thrift_obj) >>> dict_obj = thrift2dict(thrift_obj)
直接使用json进行编码/解码
>>> from thrift_json import ThriftJSONEncoder >>> json_str = json.dumps(thrift_obj, cls=ThriftJSONEncoder)
>>> from thrift_json import ThriftJSONDecoder >>> thrift_obj = json.loads(json_str, cls=ThriftJSONDecoder, thrift_class=thrift_class)
历史记录
0.1.0(2016-07-11)
- pypi上的第一个版本。