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.

Jaq – A jq clone focused on correctness, speed, and simplicity

440 pointsby tmcnealover 1 year ago

30 comments

j1eloover 1 year ago
&gt; <i>[[]] | implode crashes jq, and this was not fixed at the time of writing despite being known since five years.</i><p>Well, taking into account that jq development has been halted for 5 years and only recently revived again, it&#x27;s no wonder that bug reports have been sitting there for that time, both well known and new ones. I bet they&#x27;ll get up to speed and slowly but surely clear the backlog that has built up all this time.
评论 #38465783 未加载
评论 #38467769 未加载
gigatexalover 1 year ago
It&#x27;s so awesome when projects shout out other projects that they&#x27;re similar to or inspired by or not replacements for. I learned about <a href="https:&#x2F;&#x2F;github.com&#x2F;yamafaktory&#x2F;jql">https:&#x2F;&#x2F;github.com&#x2F;yamafaktory&#x2F;jql</a> from the readme of this project and it&#x27;s what I&#x27;ve been looking for for a long time, thank you!<p>That&#x27;s not to take away from JAQ by any means I just find the JQ style syntax uber hard to grokk so jql makes more sense for me.
评论 #38465580 未加载
评论 #38464602 未加载
评论 #38464604 未加载
评论 #38465723 未加载
评论 #38466822 未加载
评论 #38470294 未加载
Osirisover 1 year ago
I love the idea of jq but i use it infrequently enough that I have to search the manual for how to use their syntax to get what I want.<p>Sadly 99% of what I do with jq is “| jq .”
评论 #38470681 未加载
评论 #38470686 未加载
评论 #38471265 未加载
WhereIsTheTruthover 1 year ago
<a href="https:&#x2F;&#x2F;github.com&#x2F;01mf02&#x2F;jaq&#x2F;blob&#x2F;main&#x2F;Cargo.lock">https:&#x2F;&#x2F;github.com&#x2F;01mf02&#x2F;jaq&#x2F;blob&#x2F;main&#x2F;Cargo.lock</a><p>That&#x27;s a lot of dependencies..
评论 #38470001 未加载
评论 #38470592 未加载
mgaunardover 1 year ago
While jq is a very powerful tool, I&#x27;ve also been using DuckDB a lot lately.<p>SQL is a much more natural language if the data is somewhat tabular.
评论 #38463479 未加载
评论 #38464526 未加载
评论 #38476282 未加载
评论 #38463865 未加载
lopatinover 1 year ago
Regarding correctness, will it display uint64 numbers without truncating them? That&#x27;s my biggest pet peeve with jq currently.
评论 #38464480 未加载
评论 #38465115 未加载
评论 #38465844 未加载
jhatemyjobover 1 year ago
I switched to jless and never looked back. The user interface is miles ahead of everything else
评论 #38468075 未加载
jeffbeeover 1 year ago
I guess it&#x27;s cute that there&#x27;s some terminal line art library in Rust somewhere, but when I tried to invoke jaq it just pooped megabytes of escape codes into my iTerm and eventually iTerm tried to print to the printer. Too clever.<p>I tried to do `echo *json | rush -- jaq -rf .&#x2F;this-program.jq {} | datamash ...` and in that context I don&#x27;t think it&#x27;s appropriate to try to get artistic with the tty.<p>The cause of the errors, for whatever it&#x27;s worth, is that `jaq` lacks `strftime`.
评论 #38464281 未加载
olemunchover 1 year ago
My first impression is it has fancy error messages but no halt_error&#x2F;0<p><pre><code> $ .&#x2F;jaq-v1.2.0-x86_64-unknown-linux-gnu -sf aoc22-13.jq input.txt Error: undefined filter ╭─[&lt;unknown&gt;:30:18] │ 30 │ ╭─▶ &quot;bad input&quot; | halt_error 31 │ ├─▶ end; │ │ │ ╰───────────────── undefined filter ────╯ </code></pre> and (after commenting out halt_error) slower than both jq and gojq<p><pre><code> $ time jq -sf aoc22-13.jq input.txt 6415 20056 real 0m0.023s user 0m0.010s sys 0m0.010s $ $ time gojq -sf aoc22-13.jq input.txt 6415 20056 real 0m0.070s user 0m0.030s sys 0m0.000s $ $ time .&#x2F;jaq-v1.2.0-x86_64-unknown-linux-gnu -sf aoc22-13.jq input.txt 6415 20056 real 0m0.103s user 0m0.065s sys 0m0.000s </code></pre> aoc22-13.jq is here <a href="https:&#x2F;&#x2F;pastebin.com&#x2F;raw&#x2F;YiUjEu2n" rel="nofollow noreferrer">https:&#x2F;&#x2F;pastebin.com&#x2F;raw&#x2F;YiUjEu2n</a> and input.txt is here <a href="https:&#x2F;&#x2F;pastebin.com&#x2F;raw&#x2F;X0FSyTNf" rel="nofollow noreferrer">https:&#x2F;&#x2F;pastebin.com&#x2F;raw&#x2F;X0FSyTNf</a>
rad_gruchalskiover 1 year ago
I started using yq over jq. Any significant differences?
评论 #38463792 未加载
评论 #38464937 未加载
sgtover 1 year ago
The fact that jq takes almost a second to run on a Pi is crazy[0]. And the tool is written in C.<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;jqlang&#x2F;jq&#x2F;issues&#x2F;1411">https:&#x2F;&#x2F;github.com&#x2F;jqlang&#x2F;jq&#x2F;issues&#x2F;1411</a>
评论 #38470655 未加载
coldteaover 1 year ago
&gt;<i>nan &gt; nan is false, while nan &lt; nan is true.</i><p>If this wrong behavior from jq, or some artifact consistent with how the floating point spec is defined, surprising, but faithful to IEEE 754 nonetheless?
评论 #38467952 未加载
评论 #38468217 未加载
Yanaelover 1 year ago
How have you been using jq? It is more adhoc for exploring JSON files during development&#x2F;data analysis or in programs that run in production?
评论 #38466107 未加载
评论 #38466841 未加载
评论 #38467095 未加载
评论 #38475381 未加载
jbrittonover 1 year ago
The 2nd and 3rd examples make no sense to me.<p>echo &#x27;{&quot;a&quot;: 1, &quot;b&quot;: 2}&#x27; | jaq &#x27;add&#x27;<p>3<p>Construct an array from an object in two ways and show that they are equal:<p>$ echo &#x27;{&quot;a&quot;: 1, &quot;b&quot;: 2}&#x27; | jaq &#x27;[.a, .b] == [.[]]&#x27;<p>true
评论 #38508752 未加载
vjustover 1 year ago
I find jq&#x27;s syntax (and docs) kind of opaque, but I guess we have no other options. And I don&#x27;t think this latest incarnation breaks any new ground there. But it&#x27;d be better if I just wrote it myself - &quot;be the change ....&quot;
评论 #38465511 未加载
评论 #38465779 未加载
jasonlhyover 1 year ago
I think the best alternative for JQ is datawave, but it is not open source. <a href="https:&#x2F;&#x2F;dataweave.mulesoft.com&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;dataweave.mulesoft.com&#x2F;</a>
评论 #38470067 未加载
1vuio0pswjnm7over 1 year ago
All else being equal, does the speed of jaq change with the size of the input.
bilekasover 1 year ago
&gt; nan &gt; nan is false, while nan &lt; nan is true.<p>You learn something new everyday. Does anyone have any idea why this might be happening? Seems like more than just a bug..
评论 #38471005 未加载
sesmover 1 year ago
Is there a JS library that is similar to JQ but works on JS objects in memory?
232kkk33kkover 1 year ago
and in powershell you don&#x27;t need to learn all those syntaxes for different tools for different formats like jq, xmlstarlet, etc. Just convert everything to an object and query the data by using powershell syntax
iccoover 1 year ago
I use `yq` for this stuff and it handles most of this pretty well.
phplovesongover 1 year ago
Before a clicked on the link i had this gut feeling. It turned out my gut was right. It was written in rust. Go figure..
loudmaxover 1 year ago
I applaud this project&#x27;s focus on correctness and efficiency, but I&#x27;d also really like a version of `jq` that&#x27;s easy to understand without having to learn a whole new syntax.<p>`jq` is a really powerful tool and `jaq` promises to be even more powerful. But, as a system administrator, most lot of the time that I&#x27;m dealing with json files, something that behaved more like grep would be sufficient.
评论 #38462653 未加载
评论 #38463238 未加载
评论 #38463572 未加载
评论 #38463727 未加载
评论 #38463909 未加载
评论 #38462614 未加载
评论 #38463501 未加载
评论 #38464179 未加载
评论 #38464623 未加载
评论 #38463210 未加载
评论 #38464234 未加载
stickfigureover 1 year ago
Congratulations! We&#x27;re almost back to the basic functionality we used to have with XSLT.
评论 #38468795 未加载
评论 #38464488 未加载
评论 #38476322 未加载
评论 #38464813 未加载
visargaover 1 year ago
This language must be the spiritual successor of Perl
评论 #38463867 未加载
评论 #38464245 未加载
Yanaelover 1 year ago
jq have been in my toolbox since a while it’s a very great tool. But yet another query language to learn, jaq seems identical on that. I think that’s where LLMs can help a lot to make it easier for adoption, I started a project on that note to manipulate the data just with natural language, <a href="https:&#x2F;&#x2F;partial.sh" rel="nofollow noreferrer">https:&#x2F;&#x2F;partial.sh</a><p>‘cat’ your json file and describe what you want I think should be the way to go
评论 #38465297 未加载
评论 #38464981 未加载
sigmonsaysover 1 year ago
why not contribute to the existing jq project instead of starting a new one?<p>We have so many json query tools now it&#x27;s insane.
评论 #38465001 未加载
评论 #38476684 未加载
评论 #38464656 未加载
评论 #38465153 未加载
评论 #38464974 未加载
pizza_plebover 1 year ago
Somewhat off-topic, but is there a tool which integrates something like this&#x2F;jq&#x2F;fx and API requests? I’d like to be able to do some ETL-like operations and join JSON responses declaratively, without having to write a script.
评论 #38463401 未加载
评论 #38464274 未加载
dilsmatchanovover 1 year ago
Haven&#x27;t checked yet, but I am sure it&#x27;s written in Rust
评论 #38467710 未加载
评论 #38464237 未加载
评论 #38463237 未加载
fyzixover 1 year ago
I think my benchmark[1] would be a great test for this. The jq[2] version takes 50s on my machine.<p>[1] : <a href="https:&#x2F;&#x2F;github.com&#x2F;jinyus&#x2F;related_post_gen">https:&#x2F;&#x2F;github.com&#x2F;jinyus&#x2F;related_post_gen</a><p>[2]: <a href="https:&#x2F;&#x2F;github.com&#x2F;jinyus&#x2F;related_post_gen&#x2F;blob&#x2F;main&#x2F;jq&#x2F;related.jq">https:&#x2F;&#x2F;github.com&#x2F;jinyus&#x2F;related_post_gen&#x2F;blob&#x2F;main&#x2F;jq&#x2F;rela...</a>