Based on an example for Elvish.
From comment posted to HN:
I love the structured pipes, but as mentioned in another discussion, replacing the shell is a big leap for a lot of people. And you can get quite far without it with tools like "jq". And when I saw this, I just had to tinker a bit to see what I could do with Ruby, based on the example on the homepage:
$ curl -s https://api.github.com/repos/elves/elvish/issues | jr 'each{|issue| puts "#{issue["number"]}: #{issue["title"]}"} ' | head -n 11
Or (I expect pitchforks when you see the implementation for this):
$ curl -s https://api.github.com/repos/elves/elvish/issues | puts{"#{$I["number"]}: #{$I["title"]}"}' | head -n 11
$J holds the full JSON. $I holds each item processed via #each or any method in Enumerable built on top of each, if you really want to make things brief.
This also lets you process a file. E.g. if you've redirected the curl to "/tmp/elves.json", you can do "jr /tmp/elves.json 'puts{$I["title"]}'
You can further simplify by doing this:
Which lets you do:
(Warning: will happily clobber pre-defined globals, like $stdin; don't use on data users can manipulate the keys of)