diff options
author | Bob Ippolito <bob@redivi.com> | 2009-05-17 21:04:22 +0000 |
---|---|---|
committer | Bob Ippolito <bob@redivi.com> | 2009-05-17 21:04:22 +0000 |
commit | f115a9856a7e58bd82dd2d09175e2de17516c1d7 (patch) | |
tree | 9df73a22a32c38c2735b3be505cd349ce8154550 /index.rst | |
parent | 1d34eb9fd594ba65d63ea63c27a2abb7faa57cf6 (diff) | |
download | simplejson-f115a9856a7e58bd82dd2d09175e2de17516c1d7.tar.gz |
http://code.google.com/p/simplejson/issues/detail?id=56 indent changed to string
git-svn-id: http://simplejson.googlecode.com/svn/trunk@193 a4795897-2c25-0410-b006-0d3caba88fa1
Diffstat (limited to 'index.rst')
-rw-r--r-- | index.rst | 22 |
1 files changed, 13 insertions, 9 deletions
@@ -44,7 +44,7 @@ Compact encoding:: Pretty printing:: >>> import simplejson as json - >>> s = json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4) + >>> s = json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=' ') >>> print '\n'.join([l.rstrip() for l in s.splitlines()]) { "4": 5, @@ -144,10 +144,12 @@ Basic Usage If *allow_nan* is true, their JavaScript equivalents will be used (``NaN``, ``Infinity``, ``-Infinity``). - If *indent* is a non-negative integer, then JSON array elements and object - members will be pretty-printed with that indent level. An indent level of 0 - will only insert newlines. ``None`` (the default) selects the most compact - representation. + If *indent* is a string, then JSON array elements and object members + will be pretty-printed with a newline followed by that string repeated + for each level of nesting. ``None`` (the default) selects the most compact + representation without any newlines. For backwards compatibility with + versions of simplejson earlier than 2.1.0, an integer is also accepted + and is converted to a string with that many spaces. If specified, *separators* should be an ``(item_separator, dict_separator)`` tuple. By default, ``(', ', ': ')`` are used. To get the most compact JSON @@ -391,10 +393,12 @@ Encoders and decoders 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. - If *indent* is a non-negative integer (it is ``None`` by default), then JSON - array elements and object members will be pretty-printed with that indent - level. An indent level of 0 will only insert newlines. ``None`` is the most - compact representation. + If *indent* is a string, then JSON array elements and object members + will be pretty-printed with a newline followed by that string repeated + for each level of nesting. ``None`` (the default) selects the most compact + representation without any newlines. For backwards compatibility with + versions of simplejson earlier than 2.1.0, an integer is also accepted + and is converted to a string with that many spaces. If specified, *separators* should be an ``(item_separator, key_separator)`` tuple. By default, ``(', ', ': ')`` are used. To get the most compact JSON |