Python 2 rapidjson wrapper that does not use unicode objects
Project description
About
strrapidjson is a fork of the pyrapidjson library (version 0.5.1), which in turn is a Python 2.7+ wrapper for rapidjson. For Python 3+ python-rapidjson is another alternative.
Main design goal of this library is to avoid using unicode() conversions in Python 2, sticking to (usually UTF8-encoded) str() instead.
When decoding, library always creates str() objects
When encoding, ensure_ascii=False is applied by default
There are performance advantages to avoiding conversion to unicode() objects when that is not needed.
Performance-wise, strrapidjson is faster than the standard library json module and comparable to ujson and simplejson packages.
Installation
from pip:
$ pip install strrapidjson
from pip+Github:
$ pip install git+https://github.com/aarki/strrapidjson
clone and run locally (rexcursive to pull rapidjson submodule):
$ git clone --recursive https://github.com/aarki/strrapidjson.git $ cd strrapidjson $ python setup.py install
Requirements
Python2.7. Not tested in Python3+ after forking from pyrapidjson
Usage
Drop-in replacement for Python json module although function arguments to dump/load are not supported.
Example:
>>> import strrapidjson >>> strrapidjson.loads('[1, 2, {"test": "hoge"}]') >>> [1, 2, {'test': 'hoge'}] >>> strrapidjson.dumps([1, 2, {"foo": "bar"}]) '[1,2,{"foo":"bar"}]' >>>
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file strrapidjson-0.3.tar.gz
.
File metadata
- Download URL: strrapidjson-0.3.tar.gz
- Upload date:
- Size: 1.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.2.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12f745aa537a57b8a982a6c70e14d8207c9cd694002db5f5f8efbadaef156b68 |
|
MD5 | 914f6173ab7b8aebe5c207382160bea8 |
|
BLAKE2b-256 | e89e1722dc4492c48609753a3520130f04f0ae71d10e523af5930f85820cead1 |