Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

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"}]'
>>>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for strrapidjson, version 0.3
Filename, size File type Python version Upload date Hashes
Filename, size strrapidjson-0.3.tar.gz (1.0 MB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page