Merge remote-tracking branch 'jdufresne/json-docs'

This commit is contained in:
Daniele Varrazzo 2017-11-28 15:22:09 +00:00
commit e7529e4823
2 changed files with 4 additions and 10 deletions

View File

@ -539,17 +539,13 @@ fields to JSON) you can use the `register_json()` function.
.. __: http://people.planetpostgresql.org/andrew/index.php?/archives/255-JSON-for-PG-9.2-...-and-now-for-9.1!.html .. __: http://people.planetpostgresql.org/andrew/index.php?/archives/255-JSON-for-PG-9.2-...-and-now-for-9.1!.html
The Python library used by default to convert Python objects to JSON and to The Python :py:mod:`json` module is used by default to convert Python objects
parse data from the database depends on the language version: with Python 2.6 to JSON and to parse data from the database.
and following the :py:mod:`json` module from the standard library is used;
with previous versions the `simplejson`_ module is used if available. Note
that the last `!simplejson` version supporting Python 2.4 is the 2.0.9.
.. _JSON: http://www.json.org/ .. _JSON: http://www.json.org/
.. |pgjson| replace:: :sql:`json` .. |pgjson| replace:: :sql:`json`
.. |jsonb| replace:: :sql:`jsonb` .. |jsonb| replace:: :sql:`jsonb`
.. _pgjson: http://www.postgresql.org/docs/current/static/datatype-json.html .. _pgjson: http://www.postgresql.org/docs/current/static/datatype-json.html
.. _simplejson: http://pypi.python.org/pypi/simplejson/
In order to pass a Python object to the database as query argument you can use In order to pass a Python object to the database as query argument you can use
the `Json` adapter:: the `Json` adapter::

View File

@ -50,9 +50,7 @@ class Json(object):
`!Json` can be used to wrap any object supported by the provided *dumps* `!Json` can be used to wrap any object supported by the provided *dumps*
function. If none is provided, the standard :py:func:`json.dumps()` is function. If none is provided, the standard :py:func:`json.dumps()` is
used (`!simplejson` for Python < 2.6; used.
`~psycopg2.extensions.ISQLQuote.getquoted()` will raise `!ImportError` if
the module is not available).
""" """
def __init__(self, adapted, dumps=None): def __init__(self, adapted, dumps=None):