Aestate
|
Public Member Functions | |
def | encode (self, o) |
def | iterencode (self, o, _one_shot=False) |
![]() | |
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 | |
![]() | |
skipkeys | |
ensure_ascii | |
check_circular | |
allow_nan | |
sort_keys | |
use_decimal | |
namedtuple_as_object | |
tuple_as_array | |
iterable_as_array | |
bigint_as_string | |
item_sort_key | |
for_json | |
ignore_nan | |
int_as_string_bitcount | |
indent | |
key_separator | |
item_separator | |
default | |
encoding | |
![]() | |
string | item_separator = ', ' |
string | key_separator = ': ' |
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. &) 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 http://timelessrepo.com/json-isnt-a-javascript-subset).
Definition at line 383 of file encoder.py.
def aestate.ajson.sim.encoder.JSONEncoderForHTML.encode | ( | self, | |
o | |||
) |
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 encoder.py.
def aestate.ajson.sim.encoder.JSONEncoderForHTML.iterencode | ( | self, | |
o, | |||
_one_shot = False |
|||
) |
Encode the given object and yield each string representation as available. For example:: for chunk in JSONEncoder().iterencode(bigobject): mysocket.write(chunk)
Reimplemented from aestate.ajson.sim.encoder.JSONEncoder.
Definition at line 406 of file encoder.py.