Suggest ujson.loads in documentation

Related to #341
This commit is contained in:
Federico Ceratto 2019-09-23 12:07:52 +01:00 committed by GitHub
parent f08019e356
commit a3b1fd5195
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -643,7 +643,10 @@ 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)
By default, psycopg2 uses Python's standard library JSON implementation. Since ujson is much faster, you can improve performance with::
psycopg2.extras.register_default_json(loads=ujson.loads, globally=True)
psycopg2.extras.register_default_jsonb(loads=ujson.loads, globally=True)
.. autoclass:: Json