Added UltraJSON example

Close #972
This commit is contained in:
Daniele Varrazzo 2019-10-19 17:47:01 +01:00
parent 2f094841b2
commit 850c585501

View File

@ -643,6 +643,13 @@ want to convert the float values from :sql:`json` into
loads = lambda x: json.loads(x, parse_float=Decimal)
psycopg2.extras.register_json(conn, loads=loads)
Or, if you want to use an alternative JSON module implementation, such as the
faster UltraJSON_, you can use::
psycopg2.extras.register_default_json(loads=ujson.loads, globally=True)
psycopg2.extras.register_default_jsonb(loads=ujson.loads, globally=True)
.. _UltraJSON: https://pypi.org/project/ujson/
.. autoclass:: Json