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 benhoyt
Recipients Alex Gordon, andrewnester, benhoyt, berker.peksag, bob.ippolito, brett.cannon, r.david.murray, rhettinger, serhiy.storchaka, vstinner
Date 2017-02-17.17:31:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1487352670.49.0.851902507592.issue29540@psf.upfronthosting.co.za>
In-reply-to
Content
I agree with the confusion (PR proposes separators=COMPACT, issue compact=True).

I like the concept but not either of the APIs proposed. I *much* more often want to get pretty output -- if I had a dime for every time I've written "json.dumps(obj, sort_keys=True, indent=4)" I'd be rich enough to buy an entire cup of Starbucks coffee. But then you'd need a pretty=True option as well, which would be mutually exclusive with compact=True, so not great.

But what about a style= (or "format="?) parameter, which defaults to 'default' (or just None) meaning the same as now. If you pass format='pretty' you get "sort_keys=True, indent=4" and if you pass format='compact' you get "separators=(',', ':')".
History
Date User Action Args
2017-02-17 17:31:10benhoytsetrecipients: + benhoyt, brett.cannon, rhettinger, bob.ippolito, vstinner, r.david.murray, berker.peksag, serhiy.storchaka, Alex Gordon, andrewnester
2017-02-17 17:31:10benhoytsetmessageid: <1487352670.49.0.851902507592.issue29540@psf.upfronthosting.co.za>
2017-02-17 17:31:10benhoytlinkissue29540 messages
2017-02-17 17:31:10benhoytcreate