top | item 44639078

(no title)

xmonkee | 7 months 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.

discuss

order

mdaniel|7 months ago

The 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/

porridgeraisin|7 months ago

Look 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.

quotemstr|7 months ago

Hey. Don't hate on jq too much. It's a backdoor way to get functional programming past people's mental perceived complexity forcefields.

JimDabell|7 months ago

JMESPath is an alternative and has better tool support in some places (e.g. the AWS CLI).

pxc|7 months ago

What 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|7 months ago

It'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.

ashwinsundar|7 months ago

A standard for what? It just makes JSON look nicer and more query-able. You don't have to use it.

xmonkee|7 months ago

A standard as in there is a cottage industry of tools and websites built around it now, like this one.