Extracting Objects Recursively with Jq
I tend to use jq a lot. As others have said, sometimes jq can be hard to grasp. Often it requires multiple attempts to get the correct answer. To make it a little easier for me, I&#x27;ve written a helper function[0] that combines it with fzf[1] to run jq as a REPL on any json. It allows to incrementally alter your DSL without having to continually call jq. This is similar to jid&#x2F;jiq but a little more powerful. It includes functions to change the preview to output raw, compact (or not), and some other things.<p>It is essentially similar to jqplay but local.<p>I didn&#x27;t use jid&#x2F;jiq because jid uses go-simplejson, which is nowhere near as powerful as jq, and jiq seemed very buggy when I used it and it felt like it was hacked together. Plus there was no where to change jq&#x27;s arguments while running it.<p>I&#x27;m sure this function can be improved on, but this has been good enough for me so far.<p>Also, I run gojq[2] instead of jq. It is a drop-in replacement for jq but is written in Go, and has some improvements over jq such as bug fixes, support for yaml input, and it also provides more helpful error messages.<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;hoshsadiq&#x2F;dot_files&#x2F;blob&#x2F;master&#x2F;zshrc.d&#x2F;misc&#x2F;fuzzy.zsh#L27-L159" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;hoshsadiq&#x2F;dot_files&#x2F;blob&#x2F;master&#x2F;zshrc.d&#x2F;m...</a><p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;junegunn&#x2F;fzf" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;junegunn&#x2F;fzf</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;itchyny&#x2F;gojq&#x2F;" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;itchyny&#x2F;gojq&#x2F;</a>