Public Member Functions | List of all members
aestate.ajson.sim.encoder.JSONEncoderForHTML Class Reference
Inheritance diagram for aestate.ajson.sim.encoder.JSONEncoderForHTML:
Inheritance graph
Collaboration diagram for aestate.ajson.sim.encoder.JSONEncoderForHTML:
Collaboration graph

Public Member Functions

def encode (self, o)
def iterencode (self, o, _one_shot=False)
- Public Member Functions inherited from aestate.ajson.sim.encoder.JSONEncoder
def __init__ (self, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, encoding='utf-8', default=None, use_decimal=True, namedtuple_as_object=True, tuple_as_array=True, bigint_as_string=False, item_sort_key=None, for_json=False, ignore_nan=False, int_as_string_bitcount=None, iterable_as_array=False)
def default (self, o)

Additional Inherited Members

- Public Attributes inherited from aestate.ajson.sim.encoder.JSONEncoder
- Static Public Attributes inherited from aestate.ajson.sim.encoder.JSONEncoder
string item_separator = ', '
string key_separator = ': '

Detailed Description

An encoder that produces JSON safe to embed in HTML.

To embed JSON content in, say, a script tag on a web page, the
characters &, < and > should be escaped. They cannot be escaped
with the usual entities (e.g. &amp;) because they are not expanded
within <script> tags.

This class also escapes the line separator and paragraph separator
characters U+2028 and U+2029, irrespective of the ensure_ascii setting,
as these characters are not valid in JavaScript strings (see

Definition at line 383 of file

Member Function Documentation

◆ encode()

def aestate.ajson.sim.encoder.JSONEncoderForHTML.encode (   self,
Return a JSON string representation of a Python data structure.

>>> from simplejson import JSONEncoder
>>> JSONEncoder().encode({"foo": ["bar", "baz"]})
'{"foo": ["bar", "baz"]}'

Reimplemented from aestate.ajson.sim.encoder.JSONEncoder.

Definition at line 397 of file

Here is the call graph for this function:

◆ iterencode()

def aestate.ajson.sim.encoder.JSONEncoderForHTML.iterencode (   self,
  _one_shot = False 
Encode the given object and yield each string
representation as available.

For example::

    for chunk in JSONEncoder().iterencode(bigobject):

Reimplemented from aestate.ajson.sim.encoder.JSONEncoder.

Definition at line 406 of file

The documentation for this class was generated from the following file: