| Authors: | Ken Robbins <ken@kenrobbins.com>
Lele Gaifax <lele@metapensiero.it> |
|---|---|
| License: | MIT 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.
First install python-rapidjson:
$ pip install python-rapidjsonor, if you prefer Conda:
$ conda install -c conda-forge python-rapidjsonBasic 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"}'If you want to install the development version (maybe to contribute fixes or enhancements) you may clone the repository: