Published on

curl for JSON

Authors

Tiny Tip for Better JSON output from curl to a REST API

Add the following to ~/.bashrc:

function jcurl () {
  curl $@ --silent |  python -m json.tool
}

so that you get better-looking output for curl queries that return JSON :

curl https://api.github.com/users/mdda/repos
# vs.
jcurl https://api.github.com/users/mdda/repos
# which can be  *much* nicer
# (depending on whether the source already sends pretty JSON, of course)