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.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
NoneRelease 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.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00c9eac2cb64d6b82d2b0eb725c2fe5edc2ca9cafa329ffbe4696450bdd0dd2c |
|
MD5 | 51c3ffd00c212703e6c069eba8c0d5ee |
|
BLAKE2b-256 | c11cb02fd5f93db194f3c316a857637ae3c763bdac42fdcc4920eb3707ee9ea4 |
Hashes for python_rapidjson-0.6.1-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7303bb38007c24e3c4e9118b9828e1bb916dc79ee21283fbb4dfe55471bb833b |
|
MD5 | 7474529973ceceb35649010a1e3747bd |
|
BLAKE2b-256 | e698e27d01fe84ec2990638993a11cc3aadc6a5b0f147a371ff76f134d592833 |
Hashes for python_rapidjson-0.6.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8880750bcc6fbb29ffdad5e01e793fb80bbf387ff3a2201ddf91a5517aaf2c4 |
|
MD5 | 88b1041740b619759237a6a9a8de98c1 |
|
BLAKE2b-256 | 6a7c31267fccce8f043123ae60a9b75bfd0ae99a8d4dd3fcdfa41961002af673 |
Hashes for python_rapidjson-0.6.1-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d278502b1046c17b33f698bbb0007586777e0aa0e513e7eea08b49bd1e06904 |
|
MD5 | 9942fc25db0e1abb578f9345d3f16f23 |
|
BLAKE2b-256 | cba9a5c7ca4ec3136b26ba70c30f89d294597f08e1f65764433447159f4edeb3 |
Hashes for python_rapidjson-0.6.1-cp36-cp36m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38d4bc736341ece4ecab45c79161111f0176c6a21f4ed7325f6be5269f53168e |
|
MD5 | f0331bd20d6b795e43acab5fbe681c0e |
|
BLAKE2b-256 | 2282540102f02970b3517f919983abe4a004d22596a31eaf90db66dc061a498f |
Hashes for python_rapidjson-0.6.1-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74030be1aea5bacc18fc1f4f91bbedfe644f9abbf41ec2ca01e06cf8a273c9e0 |
|
MD5 | 2e5460b61eacb2531c508873e08c237c |
|
BLAKE2b-256 | 704a023af8fa7fd65c487ebd7dc283ebabd5812b81f4b52ac29f9c3b21e67958 |
Hashes for python_rapidjson-0.6.1-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 969a51dfe82ec1237e29102b9676e55756d7039e3d9236755edbab0459a89bc2 |
|
MD5 | 77315c0f8a43dc1c1b4e8db699284115 |
|
BLAKE2b-256 | c9e43f5bcaa0c69d3cc2cb2fef61410cd52f82a28d0bb146cc6255a26a85b9f7 |
Hashes for python_rapidjson-0.6.1-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d60c29bc14cc889af8c2118a526ebd66aff887d34918a76d67dd05cc76f8b488 |
|
MD5 | 146e33349d1286265f42a18630a2dc9e |
|
BLAKE2b-256 | e4191792865d3cf7b7e62a8cfb400f3b7faf9c54d380117f769f153ac690f186 |
Hashes for python_rapidjson-0.6.1-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | be283fe42fb21a6a2d48f9884e79b49da5908df79187ec3697f7fd68330d76ed |
|
MD5 | abdbf9f5d5b181496c990fd083a62b32 |
|
BLAKE2b-256 | b3061eb6686a8e0304a850de155e88cacb9723be080f6f9b14889f0ae50be0b8 |
Hashes for python_rapidjson-0.6.1-cp35-cp35m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 351c08d2c3e529291ac2bb5f8fec8ab0588b6010db51874fa4ea8d751a16054f |
|
MD5 | df14f118f3df22d1f24317b2c01712da |
|
BLAKE2b-256 | 706d589a17e4175177c63b73ee3cea2518b320fa287af1627b1308c90a2258f0 |
Hashes for python_rapidjson-0.6.1-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9011bca106ce32753c7d67f8d95ea335fd823ebbb11104eca34cff47741e7d6 |
|
MD5 | 9ed8c46a1fedfc73218970b73b69537c |
|
BLAKE2b-256 | e6ecd594d2e10100e6ed8a8d5ae8407a8e3f16209463cf1c64cdae8ac9a949d1 |
Hashes for python_rapidjson-0.6.1-cp34-cp34m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56cefa7f8cee4f5c4bf07f6d683f80c827edf0aeed98572e7bd93e047962c499 |
|
MD5 | 9e481aa12a7214053ace78c233ba2b7e |
|
BLAKE2b-256 | ff8c508a492a4f435440e43d6366a7b72c71fef6b825d1c158537d459572be45 |
Hashes for python_rapidjson-0.6.1-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3943bc26baca6190766ab0460f6b066cd6f74e2c18208c4cfa086eb030b2f853 |
|
MD5 | 115696faa94abc007307993b26aa77ec |
|
BLAKE2b-256 | c8ddea6feaa335ed97392c4f4c0dc6899f6898cebee19d139a83fb4e152aa152 |
Hashes for python_rapidjson-0.6.1-cp34-cp34m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7654ad83b727fb1839e5f9b5cc8de3f9fdb86f95912961b16ca71a972016203d |
|
MD5 | 703a3e0fa435c139f80bcfd8666d4673 |
|
BLAKE2b-256 | b1b86e295d5f2a946f76883d1556beb82eb773860f9c70b999d257ed9950c2ef |
Hashes for python_rapidjson-0.6.1-cp34-cp34m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5acd7445f0e711ba9e17a5bda8c47c203f417235b533a59cc57adb4cd351eff |
|
MD5 | 1da42c380af43ba34f06aaa5f57ab3a4 |
|
BLAKE2b-256 | b0e674e154126cfce5a1a5478b1fc287bd9f42333552cc2efff8456953ceae08 |