News for hackers. Stuff that matters.
Re:Jo – a shell command to create JSON (2016) by nfw2 on Saturday February 05, 2022 @06:12PM (#30227323)
I feel this whenever anyone advocates using jq. It boggles my mind that anyone would want to learn a whole new DSL for something that js makes trivial, especially considering js a much more expressive scripting language anyway
Re:Jo – a shell command to create JSON (2016) by viraptor on Saturday February 05, 2022 @08:14PM (#30228243)
JS is not that easy to embed in scripting though for trivial situations. After seeing a couple of jq examples I can run `jq '.foo[] | {bar, baz}' without really "learning" its DSL. But doing the same with node? That would be much larger.
Re:Jo – a shell command to create JSON (2016) by nfw2 on Saturday February 05, 2022 @11:57PM (#30229597)
And now everyone who needs to read your script needs to also find those examples to figure out what your code does. Even your not-real-world example isn't obvious to anyone unfamiliar with jq what the intent is
Re:Jo – a shell command to create JSON (2016) by viraptor on Sunday February 06, 2022 @01:26AM (#30230005)
That's about the only example you need explained to understand ~99% of real world jq usage. $dayjob has quite a bit of it around in various repos, and this actually is as real-world as it gets in my experience. Comparing that to having to learn enough JS to do the same thing in a verbose way, I'm still on the side of jq having an advantage in that case.