summaryrefslogtreecommitdiff
path: root/index.rst
diff options
context:
space:
mode:
authorBob Ippolito <bob@redivi.com>2009-12-27 10:26:07 +0000
committerBob Ippolito <bob@redivi.com>2009-12-27 10:26:07 +0000
commiteb74e8f8e9d96b6cd9bca7d533f4460b78de98df (patch)
treefcf47e5a762550d0037d86385828bd3e466b96e7 /index.rst
parentbbd8054480f46e92281d1f436e59fe4b52439561 (diff)
downloadsimplejson-eb74e8f8e9d96b6cd9bca7d533f4460b78de98df.tar.gz
http://code.google.com/p/simplejson/issues/detail?id=69
git-svn-id: http://simplejson.googlecode.com/svn/trunk@203 a4795897-2c25-0410-b006-0d3caba88fa1
Diffstat (limited to 'index.rst')
-rw-r--r--index.rst16
1 files changed, 16 insertions, 0 deletions
diff --git a/index.rst b/index.rst
index 9961f96..b4ed26e 100644
--- a/index.rst
+++ b/index.rst
@@ -199,6 +199,11 @@ Basic Usage
to a :class:`unicode` object and passed to :func:`loads`. The default
setting of ``'utf-8'`` is fastest and should be using whenever possible.
+ If *fp.read()* returns :class:`str` then decoded JSON strings that contain
+ only ASCII characters may be parsed as :class:`str` for performance and
+ memory reasons. If your code expects only :class:`unicode` the appropriate
+ solution is to wrap fp with a reader as demonstrated above.
+
*object_hook* is an optional function that will be called with the result of
any object literal decode (a :class:`dict`). The return value of
*object_hook* will be used instead of the :class:`dict`. This feature can be used
@@ -252,6 +257,11 @@ Basic Usage
specified. Encodings that are not ASCII based (such as UCS-2) are not
allowed and should be decoded to :class:`unicode` first.
+ If *s* is a :class:`str` then decoded JSON strings that contain
+ only ASCII characters may be parsed as :class:`str` for performance and
+ memory reasons. If your code expects only :class:`unicode` the appropriate
+ solution is decode *s* to :class:`unicode` prior to calling loads.
+
The other arguments have the same meaning as in :func:`load`.
@@ -334,6 +344,12 @@ Encoders and decoders
Return the Python representation of *s* (a :class:`str` or
:class:`unicode` instance containing a JSON document)
+ If *s* is a :class:`str` then decoded JSON strings that contain
+ only ASCII characters may be parsed as :class:`str` for performance and
+ memory reasons. If your code expects only :class:`unicode` the
+ appropriate solution is decode *s* to :class:`unicode` prior to calling
+ decode.
+
.. method:: raw_decode(s)
Decode a JSON document from *s* (a :class:`str` or :class:`unicode`