blob: 4ca15a3f3f4f15847b131d1fc585fcae21e3e9d2 [file] [log] [blame]
Serializer / Encoder
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.
Quick Encoder Summary
.. autosummary::
Full Encoder Description
.. autofunction:: pyjson5.encode
.. autofunction:: pyjson5.encode_bytes
.. autofunction:: pyjson5.encode_callback
.. autofunction:: pyjson5.encode_io
.. autofunction:: pyjson5.encode_noop
.. autoclass:: pyjson5.Options
Encoder Compatibility Functions
.. autofunction:: pyjson5.dump
.. autofunction:: pyjson5.dumps
Encoder Exceptions
.. inheritance-diagram::
.. autoclass:: pyjson5.Json5EncoderException
.. autoclass:: pyjson5.Json5UnstringifiableType