summaryrefslogtreecommitdiff
path: root/simplejson/encoder.py
diff options
context:
space:
mode:
authorBob Ippolito <bob@redivi.com>2009-02-16 00:48:35 +0000
committerBob Ippolito <bob@redivi.com>2009-02-16 00:48:35 +0000
commitedb409fab04d0a5ff18eeb8f0225c5bd79fc5a25 (patch)
tree3cec2c5e00f9e0103c3de6bee77709b6148ab86d /simplejson/encoder.py
parente36815997181e2d74c2180fb7fe7bb142631bae8 (diff)
downloadsimplejson-edb409fab04d0a5ff18eeb8f0225c5bd79fc5a25.tar.gz
fixed http://code.google.com/p/simplejson/issues/detail?id=35 -- no longer checks exactly for True and False
git-svn-id: http://simplejson.googlecode.com/svn/trunk@164 a4795897-2c25-0410-b006-0d3caba88fa1
Diffstat (limited to 'simplejson/encoder.py')
-rw-r--r--simplejson/encoder.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/simplejson/encoder.py b/simplejson/encoder.py
index d28298f..056847b 100644
--- a/simplejson/encoder.py
+++ b/simplejson/encoder.py
@@ -100,25 +100,25 @@ class JSONEncoder(object):
indent=None, separators=None, encoding='utf-8', default=None):
"""Constructor for JSONEncoder, with sensible defaults.
- If skipkeys is False, then it is a TypeError to attempt
+ If skipkeys is false, then it is a TypeError to attempt
encoding of keys that are not str, int, long, float or None. If
skipkeys is True, such items are simply skipped.
- If ensure_ascii is True, the output is guaranteed to be str
+ If ensure_ascii is true, the output is guaranteed to be str
objects with all incoming unicode characters escaped. If
ensure_ascii is false, the output will be unicode object.
- If check_circular is True, then lists, dicts, and custom encoded
+ If check_circular is true, then lists, dicts, and custom encoded
objects will be checked for circular references during encoding to
prevent an infinite recursion (which would cause an OverflowError).
Otherwise, no such check takes place.
- If allow_nan is True, then NaN, Infinity, and -Infinity will be
+ If allow_nan is true, then NaN, Infinity, and -Infinity will be
encoded as such. This behavior is not JSON specification compliant,
but is consistent with most JavaScript based encoders and decoders.
Otherwise, it will be a ValueError to encode such floats.
- If sort_keys is True, then the output of dictionaries will be
+ If sort_keys is true, then the output of dictionaries will be
sorted by key; this is useful for regression tests to ensure
that JSON serializations can be compared on a day-to-day basis.
@@ -356,14 +356,14 @@ def _make_iterencode(markers, _default, _encoder, _indent, _floatstr, _key_separ
# also allow them. Many encoders seem to do something like this.
elif isinstance(key, float):
key = _floatstr(key)
- elif isinstance(key, (int, long)):
- key = str(key)
elif key is True:
key = 'true'
elif key is False:
key = 'false'
elif key is None:
key = 'null'
+ elif isinstance(key, (int, long)):
+ key = str(key)
elif _skipkeys:
continue
else: