5 ms·
God I really abhor jq and it seems it's becoming a standard. I dislike it cause I'm too dumb to correctly dredge up it's incantations, and once a year I have to
by xmonkee 1y ago
God I really abhor jq and it seems it's becoming a standard. I dislike it cause I'm too dumb to correctly dredge up it's incantations, and once a year I have to go reading their arcane docs. I suppose it's another fertile ground for LLM use.
- mdaniel 1y agoThe bad news is that much like how "I'm just going to DSL this ..." inevitably morphs into a full-blown programming language[1], so too is the ubiquitous "gah, your language is too complex, I'm going to just use this other tool that implements my favorite 10% of the cases" which is a long way of saying: or else what? There's 100% no way that I'm going to ever, ever use <<python3 -c "import json, sys; print(json.load(sys.stdin)[...ohgawd...]">> and if you are, then more power to ya and jq apparently doesn't solve a problem you have 1: https://www.laws-of-software.com/laws/zawinski/ https://www.laws-of-software.com/laws/zawinski/
- ashwinsundar 1y agoA standard for what? It just makes JSON look nicer and more query-able. You don't have to use it.
- xmonkee 1y agoA standard as in there is a cottage industry of tools and websites built around it now, like this one.
- lxgr 1y agoGiven the choice between a hypothetical standard that nobody wrote (or implemented) and a tool that organically grew complex enough to benefit from a standard, I'd rather have the latter. Users (i.e. not implementors) usually also don't read the standard – they read the docs (ideally containing lots of examples on top of a dry enumeration of options), or today indeed ask an LLM.
- pxc 1y agoWhat would "non-arcane" jq docs look like? I'm kind of in the same boat, being an infrequent jq user, but I've generally found the docs pretty easy to navigate.
- benreesman 1y agoIt's a pretty good on/off-ramp into better tools. Going from arbitrary slop to something that's a reasonable input to `nixlang` or Dhall is pure win IMHO. I get a lot of use out of `jq` even though I prefer sounder systems than JSON.
- quotemstr 1y agoHey. Don't hate on jq too much. It's a backdoor way to get functional programming past people's mental perceived complexity forcefields.
- porridgeraisin 1y agoLook at gron. Or fastgron, same thing but faster. It basically dumps the flattened js equation form of the json. You can then sed grep that whatever. Then you can gron --ungron and it will make it JSON again. It works beautifully, check out the examples in their docs. fx.wtf is also very nice as an interactive viewer with vim movements. Then jo for creating json. I found it much easier to use these three + core utils as compared to learning jq, lol.
- JimDabell 1y agoJMESPath is an alternative and has better tool support in some places (e.g. the AWS CLI).