Working with iControl REST Data on the Command Line

I'm still pretty entrenched in "old school" iControl with the soap interface, but with Colin's new series on the iControl REST interface underway, I thought I'd start taking more than a glance. While Colin's sed-fu in his latest article is impressive, I want to see the json data returned from iControl REST calls parsed properly (no offense, Colin!) This can be done with any number of bash, perl, python, and more tools, but I ran across one on twitter last night that is somewhat magical. jq is a single binary you can download and it just works. So why bother? Well, as Colin pointed out, the returned json data (by default) is none too fabulous in format:

But with jq, you get nice pretty text with field callouts (jq .):

 

But wait! There's more! You can also narrow the selection to the fields you want (jq '{ name, apiAnonymous }'):

If you want to pull all the rules together, but still only return the name and code, just index by item (jq '.items[] | { name, partition, apiAnonymous }'):

Published Feb 14, 2014
Version 1.0
  • I'm going to check this out because the $select=name filter is not working for some reason and this seems far more flexible. Thanks!

     

  • App has a lot to provide its customers and eye-catching attributes.Spectrum Loginand need the subscription to play any type of video wifi provided by spectrum.

     

  • GTA San Andreas APK: Nowadays, Android is the most popular and widely used operating system. Almost more than half of the smartphones users have android mobiles. In the previous decade, people used PCs to play games as it is the only available platform.