Python wrapper around rapidjson
Project description
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
Although we tried to implement an API similar to the standard library json, being a strict drop-in replacement in not our goal and we have decided to depart from there in some aspects. See this section in the documentation for further details.
Changes
1.4 (2021-06-25)
Build binary wheel for aarch64, thanks to odidev (PR #156)
1.3 (2021-06-25)
Yet another attempt to fix automatic wheels upload
1.2 (2021-06-25)
Fix automatic wheels upload from GH Actions to PyPI
1.1 (2021-06-25)
Reduce decoder memory consumption by uniquifiying keys in the loaded dictionaries
Implement an alternative way of transmogrify JSON objects, similar to json‘s object_pairs_hook load option (issue #154)
1.0 (2020-12-13)
Require Python 3.6 or greater
New serialization options, iterable_mode and mapping_mode, to give some control on how generic iterables and mappings get encoded (fix issue #149 and issue #150)
Internal refactorings, folding “skipkeys” and “sort_keys” arguments into the mapping_mode options, respectively as MM_SKIP_NON_STRING_KEYS and MM_SORT_KEYS: “old” arguments kept for backward compatibility
Bump major version to 1, tag as “production/stable” and switch to a simpler X.Y versioning schema
0.9.4 (2020-11-16)
Fix memory leak loading an invalid JSON (issue #148)
0.9.3 (2020-10-24)
Fix access to Encoder instance attributes (issue #147)
0.9.2 (2020-10-24)
Use current master version of rapidjson
Enable GH Actions-based test workflow, thanks to Martin Thoma (PR #143)
Produce Python 3.9 wheels, disable testing under Python < 3.6
Make the character used for indentation in pretty mode a parameter (issue #135)
Handle wider precision range in timestamps fractional seconds (PR 133), thanks to Karl Seguin
Add comparison benchmarks against orjson and hyperjson (issue #130 and PR #131, thanks to Sebastian Pipping)
0.9.1 (2019-11-13)
Fix memory leak in case of failed validation (issue #126)
0.9.0 (2019-11-13)
Produce Python 3.8 wheels
Compatibility fix for Python 3.8 (issue #125)
New dump option write_mode, supporting RapidJSON’s kFormatSingleLineArray option (issue #123), thanks to Nguyễn Hồng Quân for the initial implementation (PR #124)
0.8.0 (2019-08-09)
New serialization option bytes_mode to control how bytes instances get encoded (issue #122)
0.7.2 (2019-06-09)
Hopefully fix the memory leak when loading from a stream (issue #117)
0.7.1 (2019-05-11)
Raise a more specific exception on loading errors, JSONDecodeError, instead of generic ValueError (issue #118)
Fix optimization path when using OrderedDicts (issue #119)
Fix serialization of IntEnums (issue #121)
I spent quite a lot of time investigating on the memory leak when loading from a stream (issue #117): as I was not able to fully replicate the problem, I cannot be sure I solved the problem… sorry!
0.7.0 (2019-02-11)
Raise correct exception in code samples (PR #109), thanks to Thomas Dähling
Fix compilation with system-wide install of rapidjson (issue #110)
Use current master version of rapidjson, that includes a fix for its issue #1368 and issue #1336, and cures several compilation warnings as well (issue #112 and issue #107)
Fix memory leak when using object_hook (issue #115)
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-1.4-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 762ab3887ca39e8704ee942badfb1519e1f6aebc7ad3687b2f2416d7f98dfbd6 |
|
MD5 | 6c7ee9d9afbe8f68e07706c1229fe605 |
|
BLAKE2b-256 | e650b4a054f738cec074cc6ee14b03df8c05ecf835d1579d1ac5c7d46ebf7e74 |
Hashes for python_rapidjson-1.4-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f10f0b04c2bc13e734228830d302c27696e4e52ed912a5c26cbd06e5423be5f1 |
|
MD5 | 9e1173d834aa4c38a9208bc1b0e7654d |
|
BLAKE2b-256 | 0652868bc18783e57b2297f34bface439e37bde7d84661aeab2ecd572a0170e1 |
Hashes for python_rapidjson-1.4-cp39-cp39-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc1eadf4304c2f1e20e87c415b8526d8d4247801b0e34f4d1e0e9cfcabd700f4 |
|
MD5 | dc256b6d9eb8650ccaef2c19d8c04084 |
|
BLAKE2b-256 | a078c942a5495c3f590901e00714bc1a1d9f1cd8ddb10619933727ae65fe45c1 |
Hashes for python_rapidjson-1.4-cp39-cp39-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ab6a71cd4ba5037bb2292e5d66987119492cd08e8ae8fa6c1dd9e12acc41fb8 |
|
MD5 | c8be79a2018b08023f36424ae1033bb9 |
|
BLAKE2b-256 | 29ffdd6b108200f1608815e96dec17783061162a54a33ff004c2a0fdff70f774 |
Hashes for python_rapidjson-1.4-cp39-cp39-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28673273a4bf9cb397373c752eb4887dd66ae136c5643447b7a4685f9ddc97ab |
|
MD5 | 393422559cc991b71e63bda90f2ac4e9 |
|
BLAKE2b-256 | e61f24358daa0dcb6186c2156e895422e4865512ef997a94c2448ee3b292fd00 |
Hashes for python_rapidjson-1.4-cp39-cp39-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e5ba36a1b47433f46503e27525c479ff32616a2c10e1582bca40d887dcfc390 |
|
MD5 | 4fc64262f08cb072fd16df5654dbf8d9 |
|
BLAKE2b-256 | 91a718bb46db44feebdbcb4d0cb5d21adc570fea8730e091912aba7e16b3e51e |
Hashes for python_rapidjson-1.4-cp39-cp39-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d809dcb409721ff5478ef103839e8f5e010ead7c5c036fac08486474d65b6f2c |
|
MD5 | 66c45e91c1bffa1ef843a4e08cecf967 |
|
BLAKE2b-256 | c3b3d3cc7c63876486d0df68d4c1d9f3b7890d1dbc6a119b8a9e97ce3d9132e2 |
Hashes for python_rapidjson-1.4-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6baed2701022bab10fa54ffe6a686b456e1c19b8c54acaed33da38550e8d0243 |
|
MD5 | 96afea2ba26fcef11138189ea100be32 |
|
BLAKE2b-256 | 82d13e48224751eace2967f7ec5dc635ed47361e55ac0e0962c40e4a3d488661 |
Hashes for python_rapidjson-1.4-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7075d062645f04bbd571410aff10b9e3e5ed270893feabf94d3d20677668bfd7 |
|
MD5 | 534e3bbef3ebd8269f7d1befef1c17db |
|
BLAKE2b-256 | 042f0b6646f9a29d36b7ab54e238cf10c0fbbcc95ad71b54755672c31184a6bb |
Hashes for python_rapidjson-1.4-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 939793c3a5935a685f6aacaa01193cf72f2f3617d6d58d27e62c834d36514ab8 |
|
MD5 | 3e20a8dd4a0be5bb1c435d9451d13c00 |
|
BLAKE2b-256 | 143a5ca83806329923e26372ac3f909130135cf26966f9dc8d915b72a3bc4d0f |
Hashes for python_rapidjson-1.4-cp38-cp38-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70bad2365480aabf7e0985cafe5182fd9dfda5604e62d2d69841b5cb2c7bb35f |
|
MD5 | 63cfa8f6dc7512a101585b427269ac19 |
|
BLAKE2b-256 | c38ab3a1bf6cf137478472448df33893ca03137ddb48481b49390c9ba1f5b1fc |
Hashes for python_rapidjson-1.4-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b5cc89740cfdc7815896e4a1912e252f8b489d9a763343e908ab0d8816e6f6f |
|
MD5 | b9bfbe8384fafb636e5f2ae2057bcd69 |
|
BLAKE2b-256 | 48acf3c4080f95cbad4f7c46bbec5dd200f2646a2aa4fef05ae1d090c0f5c889 |
Hashes for python_rapidjson-1.4-cp38-cp38-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63aec37ed6f239a42124bc4fef83d0544424ae4c3e7da6afdb6828f1fb0faa60 |
|
MD5 | 6463862ed821bcc1408cb5dcf5cba130 |
|
BLAKE2b-256 | 08f7367206301446a64cbbdcafe1d668ec2b7789b2f2ee3fb07cf0a9a6f150dd |
Hashes for python_rapidjson-1.4-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f14001b02ae63e21627b6b1e56f9fb7e6e93c768a8c4da26f965c2686bf4c56 |
|
MD5 | 6a6d56e740d2e19bf32cddaca443d6ea |
|
BLAKE2b-256 | bd7aa68caec278c94f7bb4e0d76f682869f5bd611b62578e4d27a92fbfe1ae0b |
Hashes for python_rapidjson-1.4-cp38-cp38-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2ffb1715dabed64f74a925cfe50cd0d1c5b7f903163e01d5d50172834dcf3e2 |
|
MD5 | 51ca07588a548c6130d44ce78a940ae3 |
|
BLAKE2b-256 | c01149dc83c1e30bec53692c670de1284b69da5a5835a54bbffbf3d15139e964 |
Hashes for python_rapidjson-1.4-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e6c6fc960dd175572c49d74b2f6c34c387bcf30e907f8cece890c2499ff9697 |
|
MD5 | f7b00b42e429a77941e12bd6b7906e89 |
|
BLAKE2b-256 | 9cd459aa542cc4faa5135ed98089cda5b22973c55eccc826873fee8e8aef3fce |
Hashes for python_rapidjson-1.4-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e07f7a44250fcb2bf288c8f85015c4f9ece839f14a301a22c6dbc99eb8fdcd1 |
|
MD5 | 3e3aad3b0664128577c5dbb11d391552 |
|
BLAKE2b-256 | fc87dfa09b2768bd0db281cd7fa012da40f1e027c8adcd6d11e00868078f2bcd |
Hashes for python_rapidjson-1.4-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8470e4c38eef9a14b8bf9413f1f0ef963f2a3d5f847c1aa7233eb5926fc46b76 |
|
MD5 | 89010bb852f27081903186e993c5e066 |
|
BLAKE2b-256 | aa20c7c1da22e4540abc897df0fae3c1b041275e2616f36b8a29a120be89bbe6 |
Hashes for python_rapidjson-1.4-cp37-cp37m-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bed8dc1e3928c6030327bcbe8b0a004a5bf4e129c88474a4e5e0acea2ac0cbb0 |
|
MD5 | 36d114df212e553dc617b4e168f0704d |
|
BLAKE2b-256 | 0d3241b97a44ae9ae8230a2fcf88bc36c07fdc9e30dff0f20a6685247c2ad7d0 |
Hashes for python_rapidjson-1.4-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 336f70822027a8ea4a7933bc7919c70d80136fe49853b98c30cb736290491989 |
|
MD5 | fa70a58b1f135f2c9fcdeaccd27dc360 |
|
BLAKE2b-256 | 78c4ba8622bd2c1d4b943c61f9a8d11d89bb7abac79cb30d8a791980866dd5c3 |
Hashes for python_rapidjson-1.4-cp37-cp37m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 551cd555ce4fe682bb7dd87ee169eb7c8b49998c259eda29b488f691cd7948b8 |
|
MD5 | 6423f2556ba91126406d64595f841c7f |
|
BLAKE2b-256 | 6787ca5d6cb46d27242c7ea359405cea36fd3928f835c2fb274ceaf523af4469 |
Hashes for python_rapidjson-1.4-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 306720c78997365036ffda265d4573f05ab0d97f533d7bc1e452ef7dd67943a3 |
|
MD5 | 26194a2afa4e193b0ae56cf4d289f980 |
|
BLAKE2b-256 | e73a2aeaac70249ba1c928a8633b85898219fbad20987d42f81185b2fac90a73 |
Hashes for python_rapidjson-1.4-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d0dfdf7bc6bd4de03da9bdca6b6d2df6b3f59293bb276df061ddbac5234da90 |
|
MD5 | 27862a40d9b27e72618f059ecd182b85 |
|
BLAKE2b-256 | 7231f5db752c0512581c807189b588e6eb9163dba3c5b8c209803159e5ad301c |
Hashes for python_rapidjson-1.4-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 832bd0d1c88ebfaa7c1ea0fae17a6f797df2cc4ebe3a300361dfbca576abdebc |
|
MD5 | 1656f44c1b827e491f1e17dd74d66702 |
|
BLAKE2b-256 | 2bf1a2928a911467af7b5b61090647477d905858e6f2b0e522a9d2ce912a8f05 |
Hashes for python_rapidjson-1.4-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33821e628dbc862b58bc5e2aadc90e7fc8ae791750de4f08dfc6f0e9ee37da06 |
|
MD5 | 692e58a5bb9102b52013d9b4fe863982 |
|
BLAKE2b-256 | 8881d2528a2d1d644cd154c7849b74f27a030796cbcf7e6ed78164c41a61e68e |
Hashes for python_rapidjson-1.4-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f27534b3773378cebaed215156eefd5b15ee05f328caabf9ae180cec27d21cb3 |
|
MD5 | 394b11de42984d1558a81fb248bd8fc5 |
|
BLAKE2b-256 | 65774adb07aba0731518dff65fbba83315b27444252a5028e858003d8006e3cc |
Hashes for python_rapidjson-1.4-cp36-cp36m-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2246b79078b65b25b11143cedc25da422f67f1083c3bcfc3b4255af4f24acad5 |
|
MD5 | 225a731576be478b41bc22ed61fe6ccd |
|
BLAKE2b-256 | 6862a1e58c4782ace6e05607460f51a5717cb498a76bfb3cc55d03a9a57ef5ea |
Hashes for python_rapidjson-1.4-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d529a6e0387c0a59e39718797b10020fc78563ae6e4173dbf4d90b8a58638ea |
|
MD5 | 581b64be476afd65690a6b1eeadef42b |
|
BLAKE2b-256 | 7dd3a748a749bba10daa394412770cb8d34c7e738c5d74706f7ec9d6f08e8a2b |
Hashes for python_rapidjson-1.4-cp36-cp36m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8430eeb08ea9cb7f383aab2880c5da79a2e9526afd3b276645a81b0a7a3261e0 |
|
MD5 | 106aaeb7810d1ec739c37c722001b5e0 |
|
BLAKE2b-256 | 63456a3fe1a84029553e9ca542a1d2ac370867808ac5fe1a2dd5e4f1dd4e542b |
Hashes for python_rapidjson-1.4-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa92ce9153734f14f19fb6999421d1af34bbe9f684a674bed3ee55b4943fd224 |
|
MD5 | 9455c9a32d6dbebab1c0aac25093d676 |
|
BLAKE2b-256 | b380a932de7b9e25a111578749ff6c8f7cafe7b96dbfc06aa12c42300f7a2f9c |
Hashes for python_rapidjson-1.4-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52ed49e4fd31e8f3b756bfaf1d5668ab97edb3520c43a24be5ef3b5f463b0d24 |
|
MD5 | 46ebbf6e45bef440c2cd5a29333e8755 |
|
BLAKE2b-256 | 3496ca097d55e7ce3874aa6b0f7f25bf6df9755871122976ee96170032888bed |
Hashes for python_rapidjson-1.4-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4034a0d15299ba403d7bb1ac1fff8ff1e06294f8c2b732524baa0ddb8a6e8cd4 |
|
MD5 | 224564802101fb2b7547792c489fa7fd |
|
BLAKE2b-256 | a43d67d8e46aee05735d5b5738296d139b030a095d402fbc867876f08e91100d |