Command line JSON interpretation can be confusing. Python's json library (2.6+) provides a simple prettifier:
$ echo '{"json":"obj"}' | python -mjson.tool { "json": "obj" }
Or facetiously (from the obligatory Internet Chuck Norris Database):
$ curl -s "http://api.icndb.com/jokes/random?firstName=Andrew&lastName=Martin" | python -mjson.tool { "type": "success", "value": { "categories": [ "nerdy", "chuck norris" ], "id": 528, "joke": "Andrew Martin doesn't use GUI, he prefers COMMAND line." } }
This can be wrapped in a handy shell function:
$ function parse_url_json() { curl -s "$@" | python -mjson.tool } $ parse_url_json 'http://api.icndb.com/jokes/random?firstName=Andrew&lastName=Martin'
2.5 users can install the simplejson library.