quart.json package

Submodules

Module contents

class quart.json.JSONDecoder(*, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, strict=True, object_pairs_hook=None)

Bases: json.decoder.JSONDecoder

class quart.json.JSONEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)

Bases: json.encoder.JSONEncoder

default(object_: Any) Any

Implement this method in a subclass such that it returns a serializable object for o, or calls the base implementation (to raise a TypeError).

For example, to support arbitrary iterators, you could implement default like this:

def default(self, o):
    try:
        iterable = iter(o)
    except TypeError:
        pass
    else:
        return list(iterable)
    # Let the base class default method raise the TypeError
    return JSONEncoder.default(self, o)
quart.json.dump(object_: Any, fp: IO[str], app: Optional['Quart'] = None, **kwargs: Any) None
quart.json.dumps(object_: Any, app: Optional['Quart'] = None, **kwargs: Any) str
quart.json.htmlsafe_dumps(object_: Any, **kwargs: Any) str
quart.json.jsonify(*args: Any, **kwargs: Any) Response
quart.json.load(fp: IO[str], app: Optional['Quart'] = None, **kwargs: Any) Any
quart.json.loads(object_: str, app: Optional['Quart'] = None, **kwargs: Any) Any
quart.json.tojson_filter(object_: Any, **kwargs: Any) jinja2.utils.Markup