yajl-py
is a Pure Python wrapper (implemented using
ctypes) to the excellent Yajl (Yet Another JSON Library) C
library.
yajl
and yajl-py
, allow for fast stream parsing of JSON
files, which enables the parsing of large files, that would
not fit in memory.
- python 2.7+, python 3.3+
- yajl
To run the tests you also require:
- make (to run
make test
)- nose (debian package ==
python-nose
)- mock (
pip install mock
)
From within the current directory run:
pip install .
To install from pypi:
pip install yajl-py
The examples directory contains full featured JSON Parsers built using
yajl
and yajl-py
. See examples/README.rst for more info.
TLDR; if using python3, yajl-py expects bytes and not strings
Python 3 fixed a whole string of issues with strings. Due to these fixes somethings taken for granted in python 2 are now explicit in python 3. The major change that affects yajl-py is related to a decision made within ctypes.
Strings going and coming from the ctypes interface to c-code are now bytes. Although we can make an explicit decision to decode and encode strings transparently to latin-1 or utf-8, this is an arbitrary choice. Even though it can be coded in such a way to make the encoding configurable, the decision has been made to keep with the decision made by ctypes and hence put the onus on the developer to decode/encode the input/output as necessary.
The following people provided valuable contributions to this library:
- Peter Dobcsanyi
- Charles Gordon
- Christopher Reighley