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.

A Common Lisp jq replacement

155 pointsby tmtvl13 days ago

17 comments

ilyash12 days ago
Opinion. Likely controversial. The fact that we need jq highlights that we are missing this functionality in shells. I argue that these days (nested) structured data is as basic requirement as having scalars, arrays and associative arrays (which bash has). It hurts my eyes seeing five line of assignment to variables where each one runs jq to extract that particular field from a data structure.<p>More at &quot;jq is a symptom&quot; - <a href="https:&#x2F;&#x2F;ilya-sher.org&#x2F;2018&#x2F;09&#x2F;10&#x2F;jq-is-a-symptom&#x2F;" rel="nofollow">https:&#x2F;&#x2F;ilya-sher.org&#x2F;2018&#x2F;09&#x2F;10&#x2F;jq-is-a-symptom&#x2F;</a><p>Related and might be interesting - &quot;JSON tools for command line&quot; - <a href="https:&#x2F;&#x2F;ilya-sher.org&#x2F;2018&#x2F;04&#x2F;10&#x2F;list-of-json-tools-for-command-line&#x2F;" rel="nofollow">https:&#x2F;&#x2F;ilya-sher.org&#x2F;2018&#x2F;04&#x2F;10&#x2F;list-of-json-tools-for-comm...</a>
评论 #43877515 未加载
评论 #43878117 未加载
评论 #43877114 未加载
behnamoh12 days ago
How is<p><pre><code> $ echo &quot;$json&quot; | cljq &#x27;(? $ &quot;root&quot; * 1)&#x27; </code></pre> more intuitive than the good ol&#x27; jq<p><pre><code> $ echo &quot;$json&quot; | jq &#x27;.root | map(.[1])&#x27; </code></pre> Really, people should know by now that jq does point-free programming.
评论 #43870714 未加载
评论 #43872840 未加载
cube222212 days ago
The sentiment resonates with me.<p>Had similar thoughts a couple years ago, and wrote jql[0] as a jq alternative with a lispy syntax (custom, not Common Lisp), and I’ve been using it for command-line JSON processing ever since!<p>[0]: <a href="https:&#x2F;&#x2F;github.com&#x2F;cube2222&#x2F;jql">https:&#x2F;&#x2F;github.com&#x2F;cube2222&#x2F;jql</a>
forty12 days ago
&gt; I seriously dislike jq&#x27;s convoluted, impossible-to-remember ad hoc DSL that instantly joined heaps of misery like CMake and gnuplot in my heart.<p>I like jq and gnuplot quite well. Makes me want to try CMake out ;)
account-512 days ago
I learned the basics of jq and quite liked it, but since I discovered Nushell it has replaced nearly all my data processing I do at the cli. It really is good technology.
评论 #43872581 未加载
gray_-_wolf12 days ago
One huge advantage of JQ is that it often is installed. I have jq in our Jenkins image, but I do not have this tool. The syntax is bit arcane, but once you invest bit of time into learning it, it starts to make sense (to a degree). It is a reasonable language for a stream processing.
评论 #43870350 未加载
评论 #43876733 未加载
selkin12 days ago
I am old enough to remember when creating a new DSL for every task was in vogue. What used to be an issue with that approach, which I&#x27;ve seen hinted to in another comment here, is that I can only become proficient in so many programming languages. Achieving proficiency requires a lot of practice, so using that specific DSL needs to have a high value to justify the time investment in practicing.<p>This issue is almost negated today: I find myself no longer writing jq queries, or regular expressions (both I am quite proficient in,) but having AI write those for me. This is exactly where the so-called &quot;vibe coding&quot; shines, and why I no longer care about tool specific DSLs.
diggan12 days ago
On a similar note: <a href="https:&#x2F;&#x2F;github.com&#x2F;borkdude&#x2F;jet">https:&#x2F;&#x2F;github.com&#x2F;borkdude&#x2F;jet</a><p>Can convert between JSON&lt;&gt;EDN&lt;&gt;YAML&lt;&gt;Transit easily, plus includes a nifty little query language that is basically Clojure, so data transformations&#x2F;extraction ends up really simple and concise.<p>I&#x27;ve always liked jq for simple things, but since I never sat down to actually work through the syntax, harder things tend to be too complicated to figure out quickly. Usually end up using Jet instead as if you already know Clojure, you already know the query language Jet uses.
评论 #43870462 未加载
vindarel12 days ago
Similar, in CL too:<p>* [lqn](<a href="https:&#x2F;&#x2F;github.com&#x2F;inconvergent&#x2F;lqn">https:&#x2F;&#x2F;github.com&#x2F;inconvergent&#x2F;lqn</a>) - query language and terminal utility for querying and transforming Lisp, JSON and other text files.<p>(by this person doing nice generative art: <a href="https:&#x2F;&#x2F;inconvergent.net&#x2F;" rel="nofollow">https:&#x2F;&#x2F;inconvergent.net&#x2F;</a>)
rafram12 days ago
The `?` query operator is just a different, equally inscrutable DSL...
pama12 days ago
Good performance improvement here: <a href="https:&#x2F;&#x2F;world-playground-deceit.net&#x2F;blog&#x2F;2025&#x2F;03&#x2F;speeding-up-cljqalbum.html" rel="nofollow">https:&#x2F;&#x2F;world-playground-deceit.net&#x2F;blog&#x2F;2025&#x2F;03&#x2F;speeding-up...</a>
评论 #43869560 未加载
评论 #43870325 未加载
ruuda12 days ago
If like me you can do basic queries in jq, but as soon as it gets slightly more complex (e.g. filter objects where some nested property that may not exist has a particular value), you wish you could do it with familiar Python&#x2F;Rust&#x2F;Javascript-like expressions and map&#x2F;filter, try <a href="https:&#x2F;&#x2F;rcl-lang.org&#x2F;#intuitive-json-queries" rel="nofollow">https:&#x2F;&#x2F;rcl-lang.org&#x2F;#intuitive-json-queries</a>.
评论 #43879050 未加载
adamgordonbell12 days ago
If you go through and learn some basic examples, JQ is a lot more understandable than seeing golfed examples in the wild might led you to believe. I wrote a tutorial once.<p>But it does also seem like a place where LLMs are handy. Why learn jq or regex or AWK, if you use them infrequently, when you can just ask an llm?<p>Edit: tutorial: <a href="https:&#x2F;&#x2F;earthly.dev&#x2F;blog&#x2F;jq-select&#x2F;" rel="nofollow">https:&#x2F;&#x2F;earthly.dev&#x2F;blog&#x2F;jq-select&#x2F;</a>
评论 #43873868 未加载
aidenn012 days ago
I&#x27;m guessing there&#x27;s supposed to be something other than an empty black box after &quot;already an improvement, in my eyes:&quot;? I&#x27;m just seeing a black box (on firefox).<p>[edit]<p>Removing &quot;Unifont&quot; from the font-family list fixes the problem, so I must have an issue with my unifont install?
precompute12 days ago
Whoa, love the website!
评论 #43869522 未加载
评论 #43870363 未加载
peterohler12 days ago
I&#x27;m clearly biased but oj which uses JSONPath is my preferred JSON manipulator. It can be installed with brew. It may not be for everyone but some of you might like it.
pletnes12 days ago
Pyjq is the python package for jq, in case you want to use jq as a library. The article claims that this doesn’t exist.
评论 #43870961 未加载