TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

jq 1.7

434 点作者 wwader超过 1 年前

34 条评论

d_t_w超过 1 年前
This is great, JQ is brilliant.<p>I love JQ so much we implemented a subset of JQ in Clojure so that our users could use it to munge&#x2F;filter data in our product (JVM and browser based Kafka tooling). One of the most fun coding pieces I&#x27;ve done, though I am a bit odd and I love writing grammars (big shoutout to Instaparse![1]).<p>I learned through my implementation that JQ is a LISP-2[2] which surprised me as it didn&#x27;t feel obvious from the grammar.<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;Engelberg&#x2F;instaparse">https:&#x2F;&#x2F;github.com&#x2F;Engelberg&#x2F;instaparse</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;jqlang&#x2F;jq&#x2F;wiki&#x2F;jq-Language-Description#:~:text=The%20jq%20language%20is%20a,their%20use%20after%20being%20deallocated">https:&#x2F;&#x2F;github.com&#x2F;jqlang&#x2F;jq&#x2F;wiki&#x2F;jq-Language-Description#:~...</a>.
评论 #37413704 未加载
评论 #37417081 未加载
评论 #37414564 未加载
评论 #37416906 未加载
评论 #37419429 未加载
nikolay超过 1 年前
I love jq, but I also use JMESPath (especially with AWS CLI), yq (bundled with tomlq and xq as well), and dasel [2]. I also wish hclq [3] wasn&#x27;t so dead!<p>[0]: <a href="https:&#x2F;&#x2F;jmespath.org&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;jmespath.org&#x2F;</a><p>[1]: <a href="https:&#x2F;&#x2F;kislyuk.github.io&#x2F;yq&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;kislyuk.github.io&#x2F;yq&#x2F;</a><p>[2]: <a href="https:&#x2F;&#x2F;github.com&#x2F;TomWright&#x2F;dasel">https:&#x2F;&#x2F;github.com&#x2F;TomWright&#x2F;dasel</a><p>[3]: <a href="https:&#x2F;&#x2F;hclq.sh&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;hclq.sh&#x2F;</a>
评论 #37413342 未加载
评论 #37413234 未加载
评论 #37413530 未加载
评论 #37413462 未加载
评论 #37416555 未加载
tambourine_man超过 1 年前
If you’re like me and use jq infrequently enough that you have to consult the documentation every time, try gron. It’s greppable json<p><a href="https:&#x2F;&#x2F;github.com&#x2F;tomnomnom&#x2F;gron">https:&#x2F;&#x2F;github.com&#x2F;tomnomnom&#x2F;gron</a>
评论 #37414640 未加载
评论 #37413516 未加载
评论 #37416613 未加载
ithkuil超过 1 年前
One of the reasons I like&#x2F;tolerate jq is that it&#x27;s stable, i.e scripts written for it a few years ago still work the same today.<p>I have some code around for yq instead that keep breaking because yq keeps improving in non backward compatible ways (I didn&#x27;t investigate how often yq introduced backwards incompatible changes, but the issue affected me several times in unrelated places, CI scripts or whatnot, that by their nature end up running with different versions of base tooling and update them at various pace)<p>I was always thus grateful to the great wisdom of the jq maintainers for their understanding of the importance of backwards compatibility.<p>I hope this announcement doesn&#x27;t mean that this stability was just an accidental side product of stagnation and that once stagnation is &quot;fixed&quot; it will be done at the expense of stability.
评论 #37416225 未加载
评论 #37415717 未加载
评论 #37415823 未加载
评论 #37416150 未加载
nikolay超过 1 年前
In addition to my previous comment about jq-like tools, I want to share a couple other interesting tools, which I use alongside jq are jo [0] and jc [1].<p>[0]: <a href="https:&#x2F;&#x2F;github.com&#x2F;jpmens&#x2F;jo">https:&#x2F;&#x2F;github.com&#x2F;jpmens&#x2F;jo</a><p>[1]: <a href="https:&#x2F;&#x2F;github.com&#x2F;kellyjonbrazil&#x2F;jc">https:&#x2F;&#x2F;github.com&#x2F;kellyjonbrazil&#x2F;jc</a>
评论 #37414827 未加载
mtmail超过 1 年前
Related last month &quot;First release of jq in 5 years&quot; <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=36951830">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=36951830</a><p>Huge fan, I use it all the time.
cryptonector超过 1 年前
Woohoo!! Finally!<p>It&#x27;s really awesome how the community pulled together and helped us recruit new maintainers to revive the project. Special thanks to, well, all involved, but especially @stedolan, @itchyny, and @owenthereal (all GitHub usernames).
paradox460超过 1 年前
jq and miller[1] are essential parts of my toolbelt, right up there with awk and vim.<p>[1]: <a href="https:&#x2F;&#x2F;github.com&#x2F;johnkerl&#x2F;miller">https:&#x2F;&#x2F;github.com&#x2F;johnkerl&#x2F;miller</a>
评论 #37413825 未加载
black_puppydog超过 1 年前
&gt; Adds new builtin pick(stream) to emit a projection of the input object or array.<p>&gt; jq -n &#x27;{&quot;a&quot;: 1, &quot;b&quot;: {&quot;c&quot;: 2, &quot;d&quot;: 3}, &quot;e&quot;: 4} | pick(.a, .b.c, .x)&#x27;<p>This is a godsend! Thanks to the contributors! &lt;3
评论 #37416305 未加载
评论 #37414097 未加载
评论 #37414093 未加载
lwhsiao超过 1 年前
I&#x27;ll give a plug for jaq [0], a clone focused on correctness, speed, and simplicity. It only implements a subset of jq, but I&#x27;ve been enjoying it so far.<p>[0]: <a href="https:&#x2F;&#x2F;github.com&#x2F;01mf02&#x2F;jaq">https:&#x2F;&#x2F;github.com&#x2F;01mf02&#x2F;jaq</a>
goku12超过 1 年前
Seeing this news today, I decided to give jq another try and ended up discovering jq-mode [1] for emacs. It doesn&#x27;t just support jq filter file editing, it supports jq in org-mode and something else called &#x27;jq-interactively&#x27;. This interactive mode allows you to apply jq interactively on a JSON or YAML (with yq) buffer. The buffer contents become the filtered value when you finish editing the jq filter with a return. This is especially impressive to see in yaml files.<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;ljos&#x2F;jq-mode">https:&#x2F;&#x2F;github.com&#x2F;ljos&#x2F;jq-mode</a>
评论 #37418341 未加载
pyrolistical超过 1 年前
Love jq. Solved many problems<p>But at one point I started write long jq modules and while it was pretty straightforward, there are less people familiar with jq.<p>So I declared jq bankruptcy and rewrote it as a nodejs script. The rest of the team was relived
评论 #37414019 未加载
ccakes超过 1 年前
There seems to be a few comments from people that dislike jq. If you&#x27;re that way inclined, gron[0] might be more your thing.<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;tomnomnom&#x2F;gron">https:&#x2F;&#x2F;github.com&#x2F;tomnomnom&#x2F;gron</a>
jfoutz超过 1 年前
jq is great. I don&#x27;t know how many times I&#x27;ve had to explain to engineers the invalid numeric literal error means your json is bad. no really, don&#x27;t trust me, copy it into the ide. it&#x27;s not jq. your message is malformed.<p>Strangely, I also have ECMA-404 and RFC8259 open in other tabs. mostly annoyance with the occasional flashes of anger over number formats and duplicate keys.
dang超过 1 年前
Recent and related:<p><i>First release of jq in 5 years</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=36951830">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=36951830</a> - Aug 2023 (27 comments)
VoodooJuJu超过 1 年前
Works well enough, but it really tripped me up at first with the syntax. Had to constantly look things up while using it.<p><pre><code> jq -r \ &#x27;.apps.http.servers.srv1.routes[0] | .match[0].header.[env.AUTH_USER_HEADER][0] = &quot;$username&quot;&#x27; </code></pre> That&#x27;s an error because you can&#x27;t select an env var key &#x27;[env.AUTH_USER_HEADER]&#x27; in the middle of a chain like that, only immediately following a pipe:<p><pre><code> | .match[0].header | .[env.AUTH_USER_HEADER][0] = &quot;$username&quot;&#x27; </code></pre> But then I need to preserve the parent object after the assignment and that pipe throws it out. Thankfully, parentheses fix that:<p><pre><code> | (.match[0].header | .[env.AUTH_USER_HEADER][0]) = &quot;$username&quot;&#x27; </code></pre> After working out the gotchas, it&#x27;s quite powerful, like regex, but a little clunky, though not nearly as much as regex.
评论 #37418832 未加载
评论 #37417446 未加载
saziba超过 1 年前
I can&#x27;t stress enough how I love jq. It saved my life countless times as data engineer. Good job guys!
wanderingmind超过 1 年前
A slight tangential question. I use ripgrep-all along with fzf to interactively search through files from cli. Is it possible to integrate jq (or some equivalent) into this search ecosystem to search through json files?
评论 #37415680 未加载
faizshah超过 1 年前
I wish there was a faster version of jq, I was only able to get a few mb&#x2F;s throughput out of jq vs few hundred mb&#x2F;s throughput out of ripgrep.<p>I often use ripgrep to setup quick bash pipelines for rapid data analysis, would love to be able to use jq for that purpose. These days I am setting up scripts with simdjson but the cost of writing a script vs quickly setting up jq or ripgrep in a bash pipeline are orders of magnitude different.
评论 #37414947 未加载
gobdovan超过 1 年前
Thought this is an array programming language considering the name&#x27;s made out of J and Q. Nice util
评论 #37413645 未加载
kenrose超过 1 年前
It&#x27;s great to see jq get some releases again.<p>It&#x27;s a big part of our check evaluation infra at OpsLevel.
reegnz超过 1 年前
Let me drop my jq-zsh-plugin here: <a href="https:&#x2F;&#x2F;github.com&#x2F;reegnz&#x2F;jq-zsh-plugin">https:&#x2F;&#x2F;github.com&#x2F;reegnz&#x2F;jq-zsh-plugin</a><p>It&#x27;s a line-editor, and allows me to query json documents ultra-fast. It optimizes for a really fast feedback.
Dowwie超过 1 年前
&#x27;jq&#x27; is a lot easier to use with ChatGPT assistance. Simply provide sample JSON and tell the LLM how you want to use JQ to parse and transform.
pygar超过 1 年前
It would be nice to have this in something like coreutils so that I can be reasonably sure it&#x27;s included in most systems.
anonymoushn超过 1 年前
A new jq release is exciting because it means that jq can finally stop mangling numbers that it does not do any math on.
arwineap超过 1 年前
The next killer feature for postman alternatives is integrated jq support for your json output.<p>Postman handles this especially poorly...
评论 #37418707 未加载
评论 #37414631 未加载
crest超过 1 年前
The addition of raw 0-byte separated output will make reliable scripting (e.g. piping into xargs -0) a lot easier.
niam超过 1 年前
Is this a proper summary of the use cases over Deno&#x2F;Python scripts?<p>* Run directly from the command line<p>* Small interpreter ~1MB<p>* Compact language (for better or worse)<p>* Stable
评论 #37420178 未加载
pantsforbirds超过 1 年前
ChatGPT has massively improved my ability to work with jq. I use it just infrequently enough that I constantly have to read the docs for anything non trivial, but ChatGPT lets me pump out scripts quickly. It&#x27;s been super nice for my work flow.
kouru225超过 1 年前
Reading “JQ” in this context makes me realize how terminally online I’ve been all these years
评论 #37416629 未加载
thiht超过 1 年前
These are great release notes. Looks like the project is in good hands
qalmakka超过 1 年前
jq is amazing, and I&#x27;d like it even more if it supported CBOR too. The forks are just too finicky and are quickly abandoned, and the format is basically binary JSON.
评论 #37418836 未加载
cjvirtucio超过 1 年前
my favorite tool; makes writing a bash fun for me.
donatj超过 1 年前
jq is a tool that is so powerful and useful it really should be made part of the POSIX standard. It should come with everything preinstalled. It’s an amazing tool like that of an earlier more refined age.