Hacker News new | ask | show | jobs
by bachmeier 2311 days ago
I personally find jq to be extremely complicated once you move beyond simple queries.
4 comments

After having used jq for some heavy data processing (building an entire Markdown document from a huge slab of JSON with no external tools), I am inclined to agree.

However, I think this may be indicative of the task you are trying to complete rather than the tool itself. At a certain level of complexity your resulting code will just look bad regardless of which language you use. One thing jq does to make this easier is providing the pipe operator, so you can break a complex task into stages: A | B | (C .... | C.5) | D | E...

You could try my Xidel, based on XPath and JSONiq ( http://www.videlibri.de/xidel.html ).

It is more verbose for simple queries, but with named variables and functions, larger queries do not become complicated

Xidel is my immediate pick for querying HTML. I use it in several scripts. Thanks!

I still prefer jq for JSON processing though. I'm hooked to pipelines. EDIT: The great power of jq is in transforming documents, not querying.

You should try out GROQ (https://groq.dev) then!
You can use a separate file to define your jq program, and even define functions to make it more readable.