Skip to content

Instantly share code, notes, and snippets.

@neilco
Last active March 17, 2017 01:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neilco/885932eb5c167e605e6e to your computer and use it in GitHub Desktop.
Save neilco/885932eb5c167e605e6e to your computer and use it in GitHub Desktop.
json_curl: Pretty-print colourised JSON output from cURL
#!/bin/sh
curl -s "$@" | python -mjson.tool | pygmentize -l json
  • Check you have Python installed:
python -V
  • Install Pygments:
[sudo] pip install Pygments
  • Copy json_curl script below and make it executable
  • Use like you would curl:
json_curl -G http://date.jsontest.com/
@hoefling
Copy link

I like the idea, although it will work only with args without quotes. consider something more sophisticated like

json_curl -X PATCH -H "Content-Type: application/json" -H "Authorization: Bearer my_token" -d '{"param": "value"}' http://example.com/api/resources/1/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment