Python wrapper around rapidjson
Project description
- Authors:
Ken Robbins <ken@kenrobbins.com>; Lele Gaifax <lele@metapensiero.it>
- License:
- Status:
RapidJSON is an extremely fast C++ JSON parser and serialization library: this module wraps it into a Python 3 extension, exposing its serialization/deserialization (to/from either bytes, str or file-like instances) and JSON Schema validation capabilities.
Latest version documentation is automatically rendered by Read the Docs.
Getting Started
First install python-rapidjson:
$ pip install python-rapidjson
or, if you prefer Conda:
$ conda install -c conda-forge python-rapidjson
Basic usage looks like this:
>>> import rapidjson
>>> data = {'foo': 100, 'bar': 'baz'}
>>> rapidjson.dumps(data)
'{"bar":"baz","foo":100}'
>>> rapidjson.loads('{"bar":"baz","foo":100}')
{'bar': 'baz', 'foo': 100}
>>>
>>> class Stream:
... def write(self, data):
... print("Chunk:", data)
...
>>> rapidjson.dump(data, Stream(), chunk_size=5)
Chunk: b'{"foo'
Chunk: b'":100'
Chunk: b',"bar'
Chunk: b'":"ba'
Chunk: b'z"}'
Development
If you want to install the development version (maybe to contribute fixes or enhancements) you may clone the repository:
$ git clone --recursive https://github.com/python-rapidjson/python-rapidjson.git
A set of makefiles implement most common operations, such as build, check and release; see make help output for a list of available targets.
Performance
python-rapidjson tries to be as performant as possible while staying compatible with the json module.
See the this section in the documentation for a comparison with other JSON libraries.
Incompatibility
Here are things in the standard json library supports that we have decided not to support:
- separators argument
This is mostly used for pretty printing and not supported by RapidJSON so it isn’t a high priority. We do support indent kwarg that would get you nice looking JSON anyways.
- Coercing keys when dumping
json will stringify a True dictionary key as "true" if you dump it out but when you load it back in it’ll still be a string. We want the dump and load to return the exact same objects so we have decided not to do this coercion.
- Arbitrary encodings
json.loads() accepts an encoding kwarg determining the encoding of its input, when that is a bytes or bytearray instance. Although RapidJSON is able to cope with several different encodings, we currently support only the recommended one, UTF-8.
Changes
0.6.2 (2018-06-08)
Use a more specific ValidationError, to differentiate from invalid JSON
0.6.1 (2018-06-06)
Nothing new, attempt to build Python 3.6 binary wheels on Travis CI
0.6.0 (2018-06-06)
Add a new comparison table involving ensure_ascii (issue #98)
Use Python’s repr() to emit float values instead of rapidjson’s dtoa() (issue #101)
Use a newer (although unreleased) version of rapidjson to fix an issue with JSONSchema validation (PR #103), thanks to Anthony Miyaguchi
0.5.2 (2018-03-31)
Tiny tweak to restore macOS build on Travis CI
0.5.1 (2018-03-31)
Minor tweaks to CI and PyPI deploy configuration
0.5.0 (2018-03-31)
0.4.3 (2018-01-14)
Deserialize from bytes and bytearray instances, ensuring they contain valid UTF-8 data
Speed up parsing of floating point numbers, avoiding intermediary conversion to a Python string (PR #94)
0.4.2 (2018-01-09)
Fix precision handling of DM_UNIX_TIME timestamps
0.4.1 (2018-01-08)
Fix memory leaks in Decoder() and Encoder() classes, related to bad handling of PyObject_GetAttr() result value
Fix compatibility with Python 3.7a
0.4.0 (2018-01-05)
0.3.2 (2017-12-21)
Reduce compiler warnings (issue #87)
0.3.1 (2017-12-20)
Fix Travis CI recipe to accomodate MacOS
0.3.0 (2017-12-20)
Fix compilation on MacOS (issue #78)
Handle generic iterables (PR #89)
Backward incompatibility: the dumps() function and the Encoder() constructor used to accept a max_recursion_depth argument, to control the maximum allowed nesting of Python structures; since the underlying function is now effectively recursive, it has been replaced by the generic sys.setrecursionlimit() mechanism
0.2.7 (2017-12-08)
Restore compatibility with Python < 3.6
0.2.6 (2017-12-08)
Fix memory leaks when using object_hook/start_object/end_object
0.2.5 (2017-09-30)
0.2.4 (2017-09-17)
Fix compatibility with MacOS/clang
0.2.3 (2017-08-24)
Limit the precision of DM_UNIX_TIME timestamps to six decimal digits
0.2.2 (2017-08-24)
Nothing new, attempt to fix production of Python 3.6 binary wheels
0.2.1 (2017-08-24)
Nothing new, attempt to fix production of Python 3.6 binary wheels
0.2.0 (2017-08-24)
0.1.0 (2017-08-16)
Remove beta status
0.1.0b4 (2017-08-14)
Make execution of the test suite on Appveyor actually happen
0.1.0b3 (2017-08-12)
Exclude CI configurations from the source distribution
0.1.0b2 (2017-08-12)
Fix Powershell wheel upload script in appveyor configuration
0.1.0b1 (2017-08-12)
Compilable with somewhat old g++ (issue #69)
Backward incompatibilities:
all DATETIME_MODE_XXX constants have been shortened to DM_XXX DATETIME_MODE_ISO8601_UTC has been renamed to DM_SHIFT_TO_UTC
all UUID_MODE_XXX constants have been shortened to UM_XXX
New option DM_UNIX_TIME to serialize date, datetime and time values as UNIX timestamps targeting issue #61
New option DM_NAIVE_IS_UTC to treat naïve datetime and time values as if they were in the UTC timezone (also for issue #61)
New keyword argument number_mode to use underlying C library numbers
Binary wheels for GNU/Linux and Windows on PyPI (one would hope: this is the reason for the beta1 release)
0.0.11 (2017-03-05)
Fix a couple of refcount handling glitches, hopefully targeting issue #48.
0.0.10 (2017-03-02)
Fix source distribution to contain all required stuff (PR #64)
0.0.9 (2017-03-02)
0.0.8 (2016-12-09)
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
Built Distributions
Hashes for python_rapidjson-0.6.2-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1032a2344656b392ba012642f9e19a7c631e3d62a28387f8532802449307df7 |
|
MD5 | df220837f71b328b72f486157ed842fb |
|
BLAKE2b-256 | bd6bfc02cc3ff3dfaf6cc1bbf7a492cbfebe36a02853329c7536216ef1bfb5fd |
Hashes for python_rapidjson-0.6.2-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bebda11961a6d5455129224267a613973aa0209e12e5848eac444734a836dcf9 |
|
MD5 | 161edff5570c55da0f9102808120826d |
|
BLAKE2b-256 | 3cc33d9431d2acfaec425a2e97a47ee84773ff9f7825ae10eb48e41dfe5f6f93 |
Hashes for python_rapidjson-0.6.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e39114dd24aa8d3304e44023cab93bcabe3ad729eb6dcd4889d0f9cbc8bebfa8 |
|
MD5 | 7c9a97bc94eb377ad6c088836a20c8ce |
|
BLAKE2b-256 | f1db91cec2bc7af8b9a001cf4174f91d5f45bd6ea993c1ea1d741101eb2d1f8a |
Hashes for python_rapidjson-0.6.2-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa78f31997f858a4493a44db9f149609ab0838e99c50a5d7e973147f0b00d437 |
|
MD5 | c5da61880847dd3e501fd5b42916e961 |
|
BLAKE2b-256 | b3c56801b8cd249e24599c5c827397bddf31d24f8a35a7a3e27aa71ce632ab80 |
Hashes for python_rapidjson-0.6.2-cp36-cp36m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe817dcb5b6aa1998fbff24fee81e07cd17fc59b92d4b2b76b93f430896284e1 |
|
MD5 | 58caeb6b5430408288c1b271d76173ad |
|
BLAKE2b-256 | 299e6be02dcd8eadb272e502cb6384bbd1c856c7b5a172e4d9cb2ede2822ce1a |
Hashes for python_rapidjson-0.6.2-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc53199f909801c5342de12a1f0659e350308778e1754bacfbafb73ec8451d2a |
|
MD5 | ca4f75f65458c4a4e3496b660879ad3a |
|
BLAKE2b-256 | a11628acf29b123322d9e0620e9db6da250545e8c5525a504305b4cefa48e88a |
Hashes for python_rapidjson-0.6.2-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8952eb7cc18ff9a6a0049e204c3df33d9fa7708396193800318cc14a4314df59 |
|
MD5 | a119354b3cab9ad025944e543e22a170 |
|
BLAKE2b-256 | 9efac9910ded1fefaba77c0135bcf19ec7fdff2b8eb4b44f4f539a957a427c26 |
Hashes for python_rapidjson-0.6.2-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e27874e8383b2a6ae125f82dd19c1acd07fe54de812f5c75a830319549061cec |
|
MD5 | 1a38ce20af83ba8db8b2346c47151e81 |
|
BLAKE2b-256 | 9ca424b090c23ae7be6b57a46d900eb417d9e8304109a77793852f585034e9bb |
Hashes for python_rapidjson-0.6.2-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f015428744abf43e515d960cd780b0cc9d7276da7dca8d6a2381fd304998dcd |
|
MD5 | b7159034ed36841a3494f8886e84903a |
|
BLAKE2b-256 | e9df7bc4e7bd7523b68658d5f4fde9ad8146c0c3577b27a22567f8afe4b6b34d |
Hashes for python_rapidjson-0.6.2-cp35-cp35m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c647a2c7d1fb28b8d133f24f538947347a87a81fcbc59de7cfda5255c7aa626 |
|
MD5 | 81a778080d4258c345a7f62f04efd774 |
|
BLAKE2b-256 | 8528437ba6d1fc4147c9d0ca1640bf251621d30fa8743b349f9d758db76f2cb9 |
Hashes for python_rapidjson-0.6.2-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a59cdd949c6785d88218301d89bac6d7bd2550d4e75ba35abad8b4a26c18424 |
|
MD5 | a91a3540eab6d6a39bd4ad14125f5181 |
|
BLAKE2b-256 | 1bec0d732d5574cfa0064c4e275c62ee999adc6d91e8e7d918316b80d343ceac |
Hashes for python_rapidjson-0.6.2-cp34-cp34m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 028afb174179f0274ea6fa8a22195f1b5a08320f4cf92766a8ebee0389d16577 |
|
MD5 | 8ee60aa4d6f34cbc82ab1cd8deae2f0e |
|
BLAKE2b-256 | 57226bab1fb5cc0d9201ebb99f7ef0f084c1a110fd509b9fd20f70714c7a73db |
Hashes for python_rapidjson-0.6.2-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97d40b98677b19334d3c15975922e2092fe8865ae827d5fc0005dc0f85cabbbf |
|
MD5 | 3fa1dd12f6efd47a8d3f86d0d279a90c |
|
BLAKE2b-256 | 1de53c4b6eeb8f945e9069307612e10530d92594c5d4693625fa33612ce5c6f5 |
Hashes for python_rapidjson-0.6.2-cp34-cp34m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 913c3355ff954985289c5939edbb7ab33082bc5177e122a3f00c557b9c38971a |
|
MD5 | 42028a169492728cef23abde1ba0490b |
|
BLAKE2b-256 | cf833ad4d4e04f1c30fc724326e0213b69e59da2a0512549c8ab33bcee3e0b5b |
Hashes for python_rapidjson-0.6.2-cp34-cp34m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e53206358247239e553bf32d3039070e807419b07e46cd0ff7f997c179db5c1 |
|
MD5 | 5a80b558964cdbfd62b4e713ee42e443 |
|
BLAKE2b-256 | 7e4657900dc8e7336fd885f25c936c441b356383b5eab34635ad5defb9643163 |