New submission from David Janes <davidja...@davidjanes.com>: 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} ---------- components: Library (Lib) messages: 117917 nosy: dpjanes priority: normal severity: normal status: open title: json.dumps with indent = 0 not adding newlines versions: Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue10019> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com