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 Alex Gordon
Recipients Alex Gordon, andrewnester, bob.ippolito, r.david.murray, rhettinger, serhiy.storchaka
Date 2017-02-14.09:20:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1487064039.84.0.620117262161.issue29540@psf.upfronthosting.co.za>
In-reply-to
Content
The point is that, as a principle of good API design, the json module should not generate malformed JSON unless the user very explicitly asks for their JSON to be corrupted.

Python stands alone in having a JSON serializer that can produce strings such as {"k",[1:2:3]} if the user holds it wrong.

Outside of Python, the 'compact' encoding is just the normal way that JSON is encoded. It's the default almost everywhere else. I'm not suggesting Python should default to it also, but I am suggesting that it should be safe and easy to remove the extraneous whitespace.

Historically there were two values you might want to pass to separators. Aside from (',', ':'), the other was (',', ': ') when indent was not None, to suppress the trailing space at the end of each line. This is no longer necessary after 3.4.

After 3.4, separators= currently acts as a very complicated boolean flag, because the only value that makes sense to pass to it is (',', ':'). With a compact flag, users could ignore separators entirely and so the API would be made simpler and safer.
History
Date User Action Args
2017-02-14 09:20:39Alex Gordonsetrecipients: + Alex Gordon, rhettinger, bob.ippolito, r.david.murray, serhiy.storchaka, andrewnester
2017-02-14 09:20:39Alex Gordonsetmessageid: <1487064039.84.0.620117262161.issue29540@psf.upfronthosting.co.za>
2017-02-14 09:20:39Alex Gordonlinkissue29540 messages
2017-02-14 09:20:39Alex Gordoncreate