blob: a2b3cc945d2bd60a18e8471370c9820f72ba4e3b [file] [log] [blame]
A JSON5 serializer and parser library for Python 3 written in
`Cython <>`_.
The serializer returns ASCII data that can safely be used in an HTML template.
Apostrophes, ampersands, greater-than, and less-then signs are encoded as
unicode escaped sequences. E.g. this snippet is safe for any and all input:
.. code:: html
"<a onclick='alert(" + encode(data) + ")'>show message</a>"
Unless the input contains infinite or NaN values, the result will be valid
`JSON <>`_ data.
All valid `JSON5 1.0.0 <>`_ and
`JSON <>`_ data can be read,
unless the nesting level is absurdly high.
You can find the full documentation online at
Or simply call ``help(pyjson5)``. :-)
The library supplies load(s) and dump(s) functions, so you can use it as a
drop-in replacement for Python's builtin ``json`` module, but you *should*
use the functions ``encode_*()`` and ``decode_*()`` instead.
At least CPython 3.5 or a recent Pypy3 version is needed.