使用如下命令即可

echo '{"key":"value"}' | python -mjson.tool

效果如下

[root@localhost ~]# echo '{"key":"value"}' | python -mjson.tool
{
"key": "value"
}