This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dpjanes
Recipients dpjanes
Date 2010-10-03.16:22:34
SpamBayes Score 2.3503e-05
Marked as misclassified No
Message-id <1286122957.24.0.240376565719.issue10019@psf.upfronthosting.co.za>
In-reply-to
Content
In Python 2.6.4, json.dumps(...,indent=0) produced newlines as documented here: http://docs.python.org/library/json.html#json.dump
In Python 2.7, it no longer adds newlines.

$ python
Python 2.6.4 (r264:75706, Jan 13 2010, 19:41:08) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import json
>>> json.dumps({3:1,4:2},indent=0)
'{\n"3": 1, \n"4": 2\n}'
>>> print json.dumps({3:1,4:2},indent=0)
{
"3": 1, 
"4": 2
}



$ python
Python 2.7 (r27:82500, Oct  3 2010, 06:00:45) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import json
>>> json.dumps({3:1,4:2})
'{"3": 1, "4": 2}'
>>> print json.dumps({3:1,4:2},indent=0)
{"3": 1, "4": 2}
History
Date User Action Args
2010-10-03 16:22:37dpjanessetrecipients: + dpjanes
2010-10-03 16:22:37dpjanessetmessageid: <1286122957.24.0.240376565719.issue10019@psf.upfronthosting.co.za>
2010-10-03 16:22:35dpjaneslinkissue10019 messages
2010-10-03 16:22:34dpjanescreate