Live data from Hacker News

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

github.com

111–120 of 254 posts

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

#111
post #99

Earlier quoted context omitted.

Nice find. I think I'll try it out. Although I was hoping for a real SQL type experience. I don't understand why no one just copies SQL so I can write a query like "SELECT * FROM $json WHERE x>1". Everyone seems to want to invent their own new esoteric symbolic query language as if everything they do is a game of code golf. I really wish everyone would move away from this old Unix mentality of extremely concise, yet…

While i agree about the general sentiment on preferring well defined and explicit standard as opposed to "cute" custom made languages. In this case i am not convince that SQL would be the best candidate for querying nested structures like JSON.Something like xpath maybe.

I agree, it wouldn't be the best to handle all json edge cases, but it would be a super easy way to quickly get data from a big chunk of simple json and you could just use subqueries or query chaining for nested results.

For anyone who hasn't used powershell, this is the difference I'm talking about. I would not be able to write either of these without looking up the syntax. But knowing very little about powershell, I can tell exactly what that command means while the bash command, not so much.

```powershell $json | ConvertFrom-Json | Select-Object -ExpandProperty x ```

```bash echo $json | jq '.x' ```

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

#112

Earlier quoted context omitted.

Which yq? I prefer https://github.com/mikefarah/yq to https://github.com/kislyuk/yq .

I prefer the former, single static binary which works great on workstations and CI alike, the latter requires python as well as jq as it's a wrapper

I've been using yq + git-xargs to automate config files in repos (CI/CD, linters, etc). The combo has been spectacular for me.

https://github.com/bbkane/git-xargs-tasks

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

#113
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, https://partial.sh

‘cat’ your json file and describe what you want I think should be the way to go

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

#114

I started using yq over jq. Any significant differences?

jq feels like a much more robust tool than yq. I understand that the task of processing YAML is much harder than JSON, but:

- yq changed its syntax between version 3 and 4 to be more like jq (but not quite the same for some reason)

- yq has no if-then-else https://github.com/mikefarah/yq/issues/95 which is a poor design (or omission) in my opinion

So yq works when you need to process YAML, it can even handle comments quite well. Buy for pure JSON processing jq is a better tool.

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

#115
post #99

It's so awesome when projects shout out other projects that they're similar to or inspired by or not replacements for. I learned about https://github.com/yamafaktory/jql from the readme of this project and it's what I've been looking for for a long time, thank you! That'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.

Nice find. I think I'll try it out. Although I was hoping for a real SQL type experience. I don't understand why no one just copies SQL so I can write a query like "SELECT * FROM $json WHERE x>1". Everyone seems to want to invent their own new esoteric symbolic query language as if everything they do is a game of code golf. I really wish everyone would move away from this old Unix mentality of extremely concise, yet…

The datafusion cli https://arrow.apache.org/datafusion/user-guide/cli.html can run SQL queries against existing json files.

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

#117
post #113

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, https://partial.sh ‘cat’ your json file and describe what you want I think should be the way to go

[deleted]

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

#118

why not contribute to the existing jq project instead of starting a new one? We have so many json query tools now it's insane.

The obvious reason here is jaq makes some changes to semantics, changes which would be rejected by jq.

Another likely reason is that it seems a motivation for jaq is improving the performance of jq. Any low-hanging fruit there in the jq implementation was likely handled a long time ago, so improving this in jq is likely to be hard. Writing a brand new implementation allows for trying out different ways of implementing the same functionality, and using a different language known for its performance helps too.

Using a language like Rust also helps with the goal of ensuring correctness and safety.

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

#119
post #99

It's so awesome when projects shout out other projects that they're similar to or inspired by or not replacements for. I learned about https://github.com/yamafaktory/jql from the readme of this project and it's what I've been looking for for a long time, thank you! That'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.

Nice find. I think I'll try it out. Although I was hoping for a real SQL type experience. I don't understand why no one just copies SQL so I can write a query like "SELECT * FROM $json WHERE x>1". Everyone seems to want to invent their own new esoteric symbolic query language as if everything they do is a game of code golf. I really wish everyone would move away from this old Unix mentality of extremely concise, yet…

SQL is built for relational/tabular data, JSON is not relational and usually not tabular.

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

#120
post #44
post #28

Earlier quoted context omitted.

I'm not sure if there is any open source XSLT tool as complete as jq is for JSON. There is xsltproc but IIRC it does not support streaming scenarios (jq has some support for streaming processing) Though, personally, I prefer JSON. Probably due to superior tools (thanks to its popularity) and less-bloated syntax (it is somewhat easier for me to read raw JSON file than raw XML file).

Saxon is where it's at. When XSLT 3.0 tells a joke, it starts with "a JSON walks into a bar..." https://github.com/Saxonica/Saxon-HE

Now that is just aggressively dumb: https://github.com/Saxonica/Saxon-HE/tree/SaxonHE12-3/12#sou... and https://github.com/Saxonica/Saxon-HE/tree/SaxonHE12-3/12/sou... (not even the decency to use .gitattributes so it knows the files are binary)

FWIW https://saxonica.plan.io/projects/saxonmirrorhe/repository seems to be the for-real source repo

Post reply on HN