diff options
author | Bob Ippolito <bob@redivi.com> | 2014-08-18 12:55:46 -0700 |
---|---|---|
committer | Bob Ippolito <bob@redivi.com> | 2014-08-18 12:55:46 -0700 |
commit | 2e83d7cc9388678ef750f7ccfa30947eed47e73d (patch) | |
tree | 2a49f303310e58c64dd7a6ce4e20f8de7302d33e | |
parent | baf6d6445c289f5d7eb5dbb14de65de48fbf56ad (diff) | |
download | simplejson-2e83d7cc9388678ef750f7ccfa30947eed47e73d.tar.gz |
documentation about key limitations in JSON per #103v3.6.3
-rw-r--r-- | CHANGES.txt | 5 | ||||
-rw-r--r-- | conf.py | 2 | ||||
-rw-r--r-- | index.rst | 15 | ||||
-rw-r--r-- | setup.py | 2 | ||||
-rw-r--r-- | simplejson/__init__.py | 2 |
5 files changed, 20 insertions, 6 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 9aa08b9..0bfde2e 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,8 @@ +Version 3.6.3 released 2014-08-18 + +* Documentation updates + https://github.com/simplejson/simplejson/issues/103 + Version 3.6.2 released 2014-08-09 * Documentation updates @@ -44,7 +44,7 @@ copyright = '2014, Bob Ippolito' # The short X.Y version. version = '3.6' # The full version, including alpha/beta/rc tags. -release = '3.6.2' +release = '3.6.3' # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: @@ -553,6 +553,15 @@ Encoders and decoders | None | null | +-------------------+---------------+ + .. note:: The JSON format only permits strings to be used as object + keys, thus any Python dicts to be encoded should only have string keys. + For backwards compatibility, several other types are automatically + coerced to strings: int, long, float, Decimal, bool, and None. + It is error-prone to rely on this behavior, so avoid it when possible. + Dictionaries with other types used as keys should be pre-processed or + wrapped in another type with an appropriate `for_json` method to + transform the keys during encoding. + It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their corresponding ``float`` values, which is outside the JSON spec. @@ -570,8 +579,8 @@ Encoders and decoders or *for_json* kwarg. This is faster and more portable than subclassing. If *skipkeys* is false (the default), then it is a :exc:`TypeError` to - attempt encoding of keys that are not str, int, long, float or None. If - *skipkeys* is true, such items are simply skipped. + attempt encoding of keys that are not str, int, long, float, Decimal, bool, + or None. If *skipkeys* is true, such items are simply skipped. If *ensure_ascii* is true (the default), the output is guaranteed to be :class:`str` objects with all incoming unicode characters escaped. If @@ -814,7 +823,7 @@ Other than the *ensure_ascii* parameter, this module is defined strictly in terms of conversion between Python objects and :class:`Unicode strings <str>`, and thus does not otherwise directly address the issue of character encodings. - + The RFC prohibits adding a byte order mark (BOM) to the start of a JSON text, and this module's serializer does not add a BOM to its output. The RFC permits, but does not require, JSON deserializers to ignore an initial @@ -11,7 +11,7 @@ from distutils.errors import CCompilerError, DistutilsExecError, \ DistutilsPlatformError IS_PYPY = hasattr(sys, 'pypy_translation_info') -VERSION = '3.6.2' +VERSION = '3.6.3' DESCRIPTION = "Simple, fast, extensible JSON encoder/decoder for Python" with open('README.rst', 'r') as f: diff --git a/simplejson/__init__.py b/simplejson/__init__.py index ad11e18..a02c4de 100644 --- a/simplejson/__init__.py +++ b/simplejson/__init__.py @@ -98,7 +98,7 @@ Using simplejson.tool from the shell to validate and pretty-print:: Expecting property name: line 1 column 3 (char 2) """ from __future__ import absolute_import -__version__ = '3.6.2' +__version__ = '3.6.3' __all__ = [ 'dump', 'dumps', 'load', 'loads', 'JSONDecoder', 'JSONDecodeError', 'JSONEncoder', |