mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-05-30 18:53:38 +03:00
parent
2f094841b2
commit
850c585501
|
@ -643,6 +643,13 @@ want to convert the float values from :sql:`json` into
|
||||||
loads = lambda x: json.loads(x, parse_float=Decimal)
|
loads = lambda x: json.loads(x, parse_float=Decimal)
|
||||||
psycopg2.extras.register_json(conn, loads=loads)
|
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
|
.. autoclass:: Json
|
||||||
|
|
Loading…
Reference in New Issue
Block a user