root@ubuntu:~# echo '{"foo": "lorem", "bar": "ipsum"}'| json_pp { "bar" : "ipsum", "foo" : "lorem" } root@ubuntu:~# echo '{"foo": "lorem", "bar": "ipsum"}'| python -mjson.tool { "bar": "ipsum", "foo": "lorem" }
来自:http://stackoverflow.com/questions/352098/how-to-pretty-print-json-script