Skip to content

Instantly share code, notes, and snippets.

@fideloper
Created December 1, 2011 15:23
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 fideloper/1417527 to your computer and use it in GitHub Desktop.
Save fideloper/1417527 to your computer and use it in GitHub Desktop.
Shell - append curl JSON request results in a nice format to an output file, with basic auth - mjson tool
#With Basic Auth
curl --user someuser:somepassword -d 'some_post=variables&go=here' http://api.somecoolapi.com/json.somedata | python -mjson.tool >> /path/of/file/to/export/to.txt
#Without Basic Auth
curl -d 'some_post=variables&go=here' http://api.somecoolapi.com/json.somedata | python -mjson.tool >> /path/of/file/to/export/to.txt
#More Goodies: http://www.davidslog.com/1187630823/format-xml-json-from-command-line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment