TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

FX: An interactive alternative to jq to process JSON

257 pointsby federicoterziover 3 years ago

18 comments

visargaover 3 years ago
JQ syntax feels too unusual, doesn&#x27;t resemble known code, gives me the feeling of looking into cryptic Perl or regex, could never remember the simplest things.<p>For example how would you take key k1 from a list of dicts [{k1: v1, k2: v2}, {k1: v3}]?
评论 #29862490 未加载
评论 #29861859 未加载
评论 #29862499 未加载
评论 #29861912 未加载
评论 #29862459 未加载
评论 #29862487 未加载
评论 #29861858 未加载
评论 #29868057 未加载
JimDabellover 3 years ago
There’s also jp, which interprets JMESPath: <a href="https:&#x2F;&#x2F;github.com&#x2F;jmespath&#x2F;jp" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jmespath&#x2F;jp</a><p>This one has the advantage of being natively understood by aws-cli, meaning you can pass a JMESPath to an AWS call and only receive the filtered &#x2F; transformed result back.
kbrazilover 3 years ago
For those who are comfortable with python, I created Jello[0], which works like jq but uses python syntax.<p>I also created Jellex[1], which is a TUI built on Jello to assist with building the python queries.<p>Jello gives you the power of python but without all of the boilerplate, so it’s nicer to use in Bash scripts.<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;kellyjonbrazil&#x2F;jello" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;kellyjonbrazil&#x2F;jello</a><p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;kellyjonbrazil&#x2F;jellex" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;kellyjonbrazil&#x2F;jellex</a>
ducaaleover 3 years ago
Apparently, the author wrote this tool because jid was struggling with a 7MB JSON file.<p>See <a href="https:&#x2F;&#x2F;github.com&#x2F;simeji&#x2F;jid&#x2F;issues&#x2F;66#issuecomment-443671843" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;simeji&#x2F;jid&#x2F;issues&#x2F;66#issuecomment-4436718...</a>
评论 #29861688 未加载
评论 #29861957 未加载
okasakiover 3 years ago
If you want to use jq but with Python syntax, I wrote pq:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;dvolk&#x2F;pq" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dvolk&#x2F;pq</a>
评论 #29861879 未加载
tyingqover 3 years ago
That&#x27;s pretty cool. Would be nice if there was an option to put the currently used filter&#x2F;query into the shell history or the clipboard. So that you could experiment to find the right one, then back out and use it in a pipeline.
评论 #29863586 未加载
lr1970over 3 years ago
gron [0] is another interesting JSON processor that follows UNIX philosophy:<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;tomnomnom&#x2F;gron" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tomnomnom&#x2F;gron</a><p>&quot;Make JSON greppable!&quot;<p>&quot;gron transforms JSON into discrete assignments to make it easier to grep for what you want and see the absolute &#x27;path&#x27; to it.&quot;
评论 #29862549 未加载
xconvergeover 3 years ago
I also like <a href="https:&#x2F;&#x2F;github.com&#x2F;dflemstr&#x2F;rq" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dflemstr&#x2F;rq</a> because it supports a few more formats (protobufs for example)
eatonphilover 3 years ago
If you&#x27;re into the SQL side (compared to jq&#x27;s custom query language) of querying arbitrary files I&#x27;ve got a comparison of some major tools here too.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;multiprocessio&#x2F;datastation&#x2F;tree&#x2F;main&#x2F;runner&#x2F;cmd&#x2F;dsq#comparisons" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;multiprocessio&#x2F;datastation&#x2F;tree&#x2F;main&#x2F;runn...</a>
fiestajetsamover 3 years ago
It would be a good idea if this was added to one of the existing[1] comparison tools for similar tools, there&#x27;s already a lot of them out there.<p>1: <a href="https:&#x2F;&#x2F;cburgmer.github.io&#x2F;json-path-comparison&#x2F;" rel="nofollow">https:&#x2F;&#x2F;cburgmer.github.io&#x2F;json-path-comparison&#x2F;</a>
peterohlerover 3 years ago
Another alternative is the oj app (ojg&#x2F;cmd&#x2F;oj) which is part of <a href="https:&#x2F;&#x2F;github.com&#x2F;ohler55&#x2F;ojg" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ohler55&#x2F;ojg</a>. It relies on JSONPath for extraction and manipulation of JSON.
meepmorpover 3 years ago
Since nobody else mentioned it, there&#x27;s also jiq, which uses jq under the hood.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;fiatjaf&#x2F;jiq" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;fiatjaf&#x2F;jiq</a>
ananthakumaranover 3 years ago
<a href="https:&#x2F;&#x2F;github.com&#x2F;akavel&#x2F;up" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;akavel&#x2F;up</a> is another tool that can be used to make most of commands interactive
_kk_331over 3 years ago
Would be really nice if there was a big warning somewhere in the installation section that it doesn&#x27;t work on windows (outside wsl).
darkstarsysover 3 years ago
Looks really nice. I wish it handled yaml as well.
评论 #29867070 未加载
jbverschoorover 3 years ago
This simply evals the argument. Not an alternative to jq.<p><pre><code> fx “code to eval”</code></pre>
评论 #29865661 未加载
评论 #29861930 未加载
greatgibover 3 years ago
Would be cool if it was not a cli made in &#x27;node&#x27;...
nqzeroover 3 years ago
do any of these json processing tools support wildcards in key names ? eg, &#x27;.long*&#x27; instead of &#x27;.longNameWithManyDetails&#x27;