~ubuntu-branches/ubuntu/precise/python3.2/precise

« back to all changes in this revision

Viewing changes to Doc/library/json.rst

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2011-02-14 16:12:14 UTC
  • mfrom: (10.1.3 experimental)
  • Revision ID: james.westby@ubuntu.com-20110214161214-f5vwa226kebccmt9
Tags: 3.2~rc3-1
Python 3.2 release candidate 3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
118
118
   file-like object).
119
119
 
120
120
   If *skipkeys* is ``True`` (default: ``False``), then dict keys that are not
121
 
   of a basic type (:class:`bytes`, :class:`str`, :class:`int`,
122
 
   :class:`float`, :class:`bool`, ``None``) will be skipped instead of raising a
123
 
   :exc:`TypeError`.
 
121
   of a basic type (:class:`str`, :class:`int`, :class:`float`, :class:`bool`,
 
122
   ``None``) will be skipped instead of raising a :exc:`TypeError`.
124
123
 
125
124
   The :mod:`json` module always produces :class:`str` objects, not
126
125
   :class:`bytes` objects. Therefore, ``fp.write()`` must support :class:`str`
203
202
 
204
203
.. function:: loads(s, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw)
205
204
 
206
 
   Deserialize *s* (a :class:`bytes` or :class:`str` instance containing a JSON
207
 
   document) to a Python object.
208
 
 
209
 
   If *s* is a :class:`bytes` instance and is encoded with an ASCII based encoding
210
 
   other than UTF-8 (e.g. latin-1), then an appropriate *encoding* name must be
211
 
   specified.  Encodings that are not ASCII based (such as UCS-2) are not
212
 
   allowed and should be decoded to :class:`str` first.
213
 
 
214
 
   The other arguments have the same meaning as in :func:`load`.
 
205
   Deserialize *s* (a :class:`str` instance containing a JSON document) to a
 
206
   Python object.
 
207
 
 
208
   The other arguments have the same meaning as in :func:`load`, except
 
209
   *encoding* which is ignored and deprecated.
215
210
 
216
211
 
217
212
Encoders and decoders