I've built a few toy apps that use json as intermediate formats and I've found JsonPath to be pretty effective at building ad-hoc queries. I wrapped it in a thin layer of python for command line use if anyone is interested.<p>Syntax and the real meat:
<a href="http://goessner.net/articles/JsonPath/" rel="nofollow">http://goessner.net/articles/JsonPath/</a><p>My rough-and-ready wrapper:
<a href="http://github.com/skorgu/pyjsonpath/tree/master" rel="nofollow">http://github.com/skorgu/pyjsonpath/tree/master</a>
Its error handling is a little odd, and it doesn't detect unexpected commands.<p><pre><code> $ resty 42; echo $?
resty: curl returned error 42
0
$
</code></pre>
(curl was never called.)