Archive

Posts Tagged ‘pretty-print’

Prettify a JSON file

August 10, 2011 1 comment

Problem
You want to make a JSON file (string) human-readable.

Solution

curl -s http://www.reddit.com/r/nsfw/.json | python -mjson.tool

For some more alternatives please refer to this post.

Update (20121021)
Another way is to use jq, a powerful command-line tool for querying JSON files.

Categories: python Tags: , , ,
Design a site like this with WordPress.com
Get started