echo '{"foo": "lorem", "bar": "ipsum"}' | python -m json.tool

http://stackoverflow.com/a/1920585/1133742