Skip to main content

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.

Source Distribution

strrapidjson-0.3.tar.gz (1.0 MB view details)

Uploaded Source

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

Hashes for strrapidjson-0.3.tar.gz
Algorithm Hash digest
SHA256 12f745aa537a57b8a982a6c70e14d8207c9cd694002db5f5f8efbadaef156b68
MD5 914f6173ab7b8aebe5c207382160bea8
BLAKE2b-256 e89e1722dc4492c48609753a3520130f04f0ae71d10e523af5930f85820cead1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page