API#

Anything documented here is part of the public API that flask-ujson provides, unless otherwise indicated. Anything not documented here is considered internal or private and may change at any time.

class flask_ujson.UjsonProvider(app)#

A JSONProvider that uses the fast ujson library.

Parameters:

app (App) –

dump_args: dict[str, Any] = {'default': <function _default>, 'encode_html_chars': True, 'ensure_ascii': False}#

Default keyword arguments passed to ujson.dumps.

dumps(obj, **kwargs)#

Serialize data as JSON.

Parameters:
  • obj (Any) – The data to serialize.

  • kwargs (Any) – Arguments passed to ujson.dumps. Overrides defaults set by dump_args.

Return type:

str

loads(s, **kwargs)#

Deserialize data as JSON.

Parameters:
  • s (str | bytes) – Text or UTF-8 bytes.

  • kwargs (Any) – All keyword arguments are silently ignored.

Return type:

Any