Daniel Himmelstein added the comment:

@serhiy.storchaka I totally understand the desire to keep json.tool simple. 
However, given the description of json.tool in the documentation (below), I 
think an indentation option is within scope:

> The json.tool module provides a simple command line interface to validate and 
> pretty-print JSON objects.

Indentation/newlines are a fundamental aspect of "pretty-printing". Right now I 
rarely use json.tool, since indent=4 is too extreme from a visual and file size 
perspective. Instead I prefer `indent=2` (or even `indent=1`) and I now have to:

1. create a python script to set my desired input
2. make sure every environment has access to this python script (the real 
annoyance)

Currently, json.tool has a --sort-keys argument, which I think is great. 
--sort-keys is also an essential feature from my perspective (bpo-21650). So in 
short, I think json.tool is close to being a really useful utility but falls a 
bit short without an indentation option.

Given that json.tool exists, I think it makes sense to take steps to make sure 
it's actually relevant as a json reformatter. Given this motivation, I'm not 
opposed to adding --compact, if we're confident it will be forward compatible 
with the json.dump API.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29636>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to