やってみる

アウトプットすべく己を導くためのブログ。その試行錯誤すらたれ流す。

MinifyされUnicodeエンコードされたJSONを整形しつつUnicodeデコードして表示したい

 人の目にやさしい表示を! ワンライナーで!

結論

Python3版

python3 -m json.tool /tmp/work/ifttt.json | python3 -c 'from sys import stdin; print(stdin.buffer.read().decode("unicode-escape"))'

Python2版

python -m json.tool /tmp/work/ifttt.json | python -c 'from sys import stdin; print stdin.read().decode("unicode-escape")'

対象環境

$ uname -a
Linux raspberrypi 5.10.52-v7l+ #1441 SMP Tue Aug 3 18:11:56 BST 2021 armv7l GNU/Linux