- Published on
curl for JSON
- Authors
- Name
- Martin Andrews
- @mdda123
curl
to a REST API
Tiny Tip for Better JSON output from 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)