Skip to content

Latest commit

 

History

History
73 lines (48 loc) · 1.54 KB

encoder.rst

File metadata and controls

73 lines (48 loc) · 1.54 KB

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:

"<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

~pyjson5.encode ~pyjson5.encode_bytes ~pyjson5.encode_callback ~pyjson5.encode_io ~pyjson5.encode_noop ~pyjson5.dump ~pyjson5.dumps ~pyjson5.Options ~pyjson5.Json5EncoderException ~pyjson5.Json5UnstringifiableType

Full Encoder Description

pyjson5.encode

pyjson5.encode_bytes

pyjson5.encode_callback

pyjson5.encode_io

pyjson5.encode_noop

pyjson5.Options

Encoder Compatibility Functions

pyjson5.dump

pyjson5.dumps

Encoder Exceptions

pyjson5.Json5Exception pyjson5.Json5EncoderException pyjson5.Json5UnstringifiableType

pyjson5.Json5EncoderException

pyjson5.Json5UnstringifiableType