[issue29540] Add compact=True flag to json.dump/dumps

2017-02-14 Thread Alex Gordon
Alex Gordon added the comment: 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 {&q

[issue29540] Add compact=True flag to json.dump/dumps

2017-02-12 Thread Alex Gordon
New submission from Alex Gordon: Broadly speaking, there are three main output styles for json.dump/dumps: 1. Default: json.dumps(obj) 2. Compact: json.dumps(obj, separators=(',', ':')) 3. Pretty-printing: json.dumps(obj, sort_keys=True, indent=4) The 'compact'