短ければコピペして手元の Windows でフォーマットすればいいのですがちょっと長めです
ローカルまでコピーしてくるのも面倒ですし フォーマットするツールをインストールするのもできれば避けたいです
いい方法ないものかと探してみると Python でできました
python3 -m json.tool min.json
これで min.json をフォーマットして表示できます
デフォルトでいろいろな機能が揃ってるのでやっぱり Python は便利ですね
CentOS8 はデフォルトで入ってないのが残念ですが これくらいなら platform-python 使ってしまって良いかも
注意したいのは 複数指定できないところです
python3 -m json.tool a.json b.json
とすると 2 つを見れるのではなく b.json へ出力となって もとの b.json は消えてしまいます
使い方
user@ubuntu ~> python3 -m json.tool --help
usage: python -m json.tool [-h] [--sort-keys] [infile] [outfile]
A simple command line interface for json module to validate and pretty-print
JSON objects.
positional arguments:
infile a JSON file to be validated or pretty-printed
outfile write the output of infile to outfile
optional arguments:
-h, --help show this help message and exit
--sort-keys sort the output of dictionaries alphabetically by key