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.3 (2018-07-11)
No visible changes, but now PyPI carries binary wheels for Python 3.7.
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.3-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4066a69fb074262d2309abe0436630241ca5be5e3c23147c178a138c944ffeba |
|
MD5 | 840c57bc43befb730ef813c1d772a1eb |
|
BLAKE2b-256 | 3298953d49acde1aee5811d27708ae58623a55bd59e2481ad737d4b708ea2325 |
Hashes for python_rapidjson-0.6.3-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 209e9d9b813641a7bc5ead254f4dfe3a2b43f39ca16eabb36e6b796316cc5a49 |
|
MD5 | b068d695803d27964f181ca594a3538b |
|
BLAKE2b-256 | b5f0bd72d043277e9eb03004509c9be0e3c426ba005a566916a8bd449ae3cdce |
Hashes for python_rapidjson-0.6.3-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 784a13b6af5380ccd6dcafbf19fef78bd1028f0c4356be810c1edfbe99e08d07 |
|
MD5 | 179e524078c59e729edd3cf4fc6820cf |
|
BLAKE2b-256 | 8ae7bbe749d8359a3f14f84e30fbed480e5cede71d8496386866a16b78fc1c06 |
Hashes for python_rapidjson-0.6.3-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a55a386f87213b1cc69bb4979eb6a77a1f149216f0514adeb06ac0e8fb7e3904 |
|
MD5 | a8d2e24f5b621a434ebc5d119c9842ab |
|
BLAKE2b-256 | fcc5c5196c71e0dff918726092d2abcfc268f557deb69b19d0bfc553f8f80a75 |
Hashes for python_rapidjson-0.6.3-cp37-cp37m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77caf809475356690152ee5931380e54cafe7202838e220608794987837a1014 |
|
MD5 | 4f54d295934741f55da2ad558b2905f7 |
|
BLAKE2b-256 | 4deb27589d8a1a6d852e5b07804bd83e95b5300c356b8957dd32b2499739caa6 |
Hashes for python_rapidjson-0.6.3-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7785ebc48f66386fe185a2034050a3db493d2b2ac6f01f4504b38f663e2136f9 |
|
MD5 | 3ee54c7eba0a3fdeeb9d9104c1283a95 |
|
BLAKE2b-256 | 769d59ec47cab6a59eb014387c3c49a18539f74af5cbd5e215df615eb2d6fc8a |
Hashes for python_rapidjson-0.6.3-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0156939b77d7a4f2ef5f627cabbfcae52f993325626cefc783fe529d42092f51 |
|
MD5 | 9bf60627b3f8828222fa49620419f157 |
|
BLAKE2b-256 | 16e56f3e464af6ba2e095034b525fff3a0cc1330a2e75c1214f9df20e4b65ad1 |
Hashes for python_rapidjson-0.6.3-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2241e6b0ba4e9bec139e97f6d9f17e9d308de905d66bf5cf88c5636193474a5f |
|
MD5 | 4f08616632e2f9b04406ec38ce374e0e |
|
BLAKE2b-256 | a7a31f6c756e84e60f674651ccb18a80090dddde9501a90f39b21d77e5a13dbd |
Hashes for python_rapidjson-0.6.3-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f32fda807dea4805b1b93affbde1af7a06119e5828b81eb71a04fa0580c6e5ad |
|
MD5 | aef2ca7ec3fd88b4597ba60996d95f23 |
|
BLAKE2b-256 | 347d61de52b6ed4cf19d74f1ac6efc546e5a46c018b9c46e53fad20475682edc |
Hashes for python_rapidjson-0.6.3-cp36-cp36m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7abb51dac9092450e31b874f9f02e141cd42a7ebc6ce2ed3191891c53da976a8 |
|
MD5 | 92f6a45f05f4c57bd12887c83405768e |
|
BLAKE2b-256 | 5728033b3fcab3cc1a93f0a57383f7a83dc0772245502ac7fb0173f4ea141eb8 |
Hashes for python_rapidjson-0.6.3-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7fff2a22754c4d1b9a34f16d124d92f414f2472d043a652a83b911b3736735e |
|
MD5 | c0b6e1f5a3d11ebd1c7b155acb23e9c9 |
|
BLAKE2b-256 | 83bf2cb27e23dfdcee73d19e0e70e5c11d82194cce2a57d7849a93adf605b0f1 |
Hashes for python_rapidjson-0.6.3-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd20cd2e6a31a5b42da6c204fe453f67468e862d34f5d678d0df4195ac8039c2 |
|
MD5 | 026a154af556f77dfe6575033a71dbc5 |
|
BLAKE2b-256 | 9a3d17e5f956d84c8cec14f751a980d2915ada8fa5b84aacc8bf5230ef7fe60e |
Hashes for python_rapidjson-0.6.3-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b844728f6a932e50ea6650d2207e81506c20a3d318651ed7b86ed101b75f50dd |
|
MD5 | 799209f19c556ff3699e22f58be2e3f6 |
|
BLAKE2b-256 | db4aa29644615b1ab576486db9e2d196292d7689d10495fe087dc002827a3293 |
Hashes for python_rapidjson-0.6.3-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1201cadb61ce05a9ec896c4f0e4365d2500894990cf8c885e271acdb4038b95 |
|
MD5 | 654ee4a66abc9c5e0446a05105ea50ad |
|
BLAKE2b-256 | 4be6396d13fb00f82345a32b40039e222e7b21a7c733ff982557ea75a4ca350a |
Hashes for python_rapidjson-0.6.3-cp35-cp35m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ca153a4a5f9c1c5774ebec085d6775124dbbf0f7bf3894dec2cbc0910963a8f |
|
MD5 | 2b9c8b4364a02b589bd13eb9f052c1d3 |
|
BLAKE2b-256 | 4a4b764611292525dcb07eb710284983dc30d358a7f476c303f5ae222139c829 |
Hashes for python_rapidjson-0.6.3-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4a3a20321e7b5bd7a3fe9451cc4437c1c6a221dc31784a1fc4de5613eccaab3 |
|
MD5 | 9e2f3b0ceada50d7d1ac6e55658b5712 |
|
BLAKE2b-256 | 0525e27f146af7fe75834394dd873585ba5385b4e65e62c3bacf067adad3d5e7 |
Hashes for python_rapidjson-0.6.3-cp34-cp34m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 626bdea30d3029c3069f5a5b324e8f92f775ae7bb90568022a93f8906954518a |
|
MD5 | 2f1e55ffe5777a112602e562f4421746 |
|
BLAKE2b-256 | 0c7bf15c576ace668f0cd9c5e188dd3cb58293c569e9b35b3b7aa30dd74fd9ef |
Hashes for python_rapidjson-0.6.3-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2cdd343ec844ec06c6819c79cb83c3ba52b12bb421923ddfdf94f1e233b09d34 |
|
MD5 | a6bacf63183d8b17decb6e32e03b0d1e |
|
BLAKE2b-256 | 3f1ef133f6de3fff53c0ebeb756c28027baa83d37a068aee08307f077d6f1f24 |
Hashes for python_rapidjson-0.6.3-cp34-cp34m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0cddd7afb5f95d7966836e93a8eae5e31f38e602b57ba6749f9f14473c09470b |
|
MD5 | 376e0ff5993fa54c1e09e655ac0ad616 |
|
BLAKE2b-256 | 213321fbb1e232dcc3e7d82225cc09b6ac2a8dd124d98b1bdcef24a5f1de1562 |
Hashes for python_rapidjson-0.6.3-cp34-cp34m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b5990989d446e1dbffa87e60b38043a9e5fc28ded970d3776d06e3ae68d1eb6 |
|
MD5 | d9e338d9dc4d06ba6a5cfe218dd4f10d |
|
BLAKE2b-256 | c3b5172fe5d74827f06cb34243c6ebaac643360289fc198559f7baa80813dd59 |