包装安装的最好的json,返回到内部simplejson。
omnijson的Python项目详细描述
问题
# Python 2.5.4 (r254:67916, Jun 24 2010, 21:47:25) >>> import anyjson Traceback (most recent call last): File "<stdin>", line 1, in <module> raise ImportError("No supported JSON module found") ImportError: No supported JSON module found
解决方案
>>> import omnijson as json # \o/
功能
- 加载安装最快的json模块
- 回到纯python simplejson中构建,以防万一。
- 正确的api(loads(),dumps())
- 可春化
- 支持python 2.5-3.2开箱即用
用法
加载可用的最佳json:
import omnijson as json
转储一些对象:
>>> json.loads('{"yo": "dawg"}') {'yo': 'dawg'}
加载一些对象:
>>> json.dumps({'yo': 'dawg'}) '{"yo": "dawg"}'
检查json引擎:
>>> json.engine 'ujson'
安装
安装omnijson很容易:
$ pip install omnijson
的,如果必须的话:
$ easy_install omnijson
许可证
麻省理工学院的执照:
Copyright (c) 2011 Kenneth Reitz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.