Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You want to provide any examples of what you mean or just leave a statement saying "jq is the worst ever"?


If you can't recall the syntax 3 days later it's terrible. Same applies to awk, sed and the like. No matter how many times I used them for something, I always have to resort to the documentation, chatgpt or the like because I just can't remember the contrived syntax. Maybe I'm retarded somehow... ¯\_(ツ)_/¯

Python (dead simple, easy to recall):

if monkey == 'fat':

    print('happy')
vs. bash (horrible syntax pitfalls):

if [ "$monkey" = 'fat' ]; then

  echo 'happy'
fi

you gonna forget about the semicolon, the spaces around the condition and it will error out. not to mention integer comparison operators...

python also has some terrible syntax, but those are advanced things, like list comprehensions.

jq...it's the same as awk, sed, bash... hard to remember for the reasons mentioned above


I think it's quite nice and intuitive to describe a pipe of filters as: filter | filter | filter. Also note that a single filter in jq is 1:N, 1 input N output where N can be zero which is a very useful feature. To express this in python etc you would probably need nested for i in (for j in ...)) and/or also use nested yield from somehow which results in a note a very CLI/ad-hoc query friendly syntax


Aside, your post looks funny because 2-space indentation triggers code formatting (so only the body of those if statements are formatted as such, instead of the whole thing).


i think the problem is it doesn't have easy to find documentation, if any at all, that introduces it as a formal language so everything is just a very hard guessing game of easily forgettable syntax.

You know, a list of reserved words, what their functions are, how the structure works, etc ... the kind you'll see if you pick up some "intro to <language X>" book from no-starch or o'reilly or the kind that GNU Awk/sed/dc have.


I suspect Stephen made a trade off between terseness and power and it being intuitive. Part of the value of jq is that it's effectively a "small program" that can easily be piped in a one liner rather than a program that has clear English keywords as an instruction.


I don’t understand, isn’t the manpage for jq exactly that, a list of syntax constructs and reserved words (mostly builtin filters) ?

If anything, it’s _too_ formal and may be missing some example for more complex usages that combine several features.


I hadn't seen it in a long time. There's this wrong assumption that the world remains static. It wasn't like this before.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: