Note for simple uses, Python 2.6+ comes with the "json.tool" module (also part of simplejson if you're <= 2.5), which reads JSON on stdin (or argv[1]) before pretty printing it.
$ type json
json is aliased to `python -m json.tool'
$ curl -s twitter.com/users/BarackObama.json|json|grep '"url"'
"url": "http://www.barackobama.com",
Please never use grep on json. If you are going to use python as a heavyweight json_reformat, at least have the decency to use all of python's excellent json lib.
Comments
Note for simple uses, Python 2.6+ comes with the "json.tool" module (also part of simplejson if you're <= 2.5), which reads JSON on stdin (or argv[1]) before pretty printing it.
Please never use grep on json. If you are going to use python as a heavyweight json_reformat, at least have the decency to use all of python's excellent json lib.