Re:jq 1.7 released
by cryptonector on Wednesday September 06, 2023 @10:10PM
(#37413884)
jq can be used trivially to approach gron-like output:
jq -r 'paths(scalars) as $p | getpath($p) | "\($p|join(".")) = \(.)"'
See elsewhere in this subthread for a full gron implementation in jq.'Trivially'
Re:jq 1.7 released
by cryptonector on Thursday September 07, 2023 @12:24AM
(#37414747)
Start with `jq -c 'paths(scalars)` -- that's pretty trivial.
I think parent is referring to the habit of technically inclined folks of using "trivially" similar to words like "simply" and "just" [0][1] in a way that assumes too much about what the reader already knows.
[0] https://www.parkersoftware.com/blog/stop-using-simply-in-tec...
Re:jq 1.7 released
by cryptonector on Thursday September 07, 2023 @11:03AM
(#37419960)
Or maybe I'm trying to whet one's appetite for learning the thing by showing a relatively simple expression that demonstrates the power of the language.
But ChatGPT has genuinely solved my suffering writing jq, it does a pretty good job. It even almost replaces gron, if you feed it an exmaple json and ask for jq, it gives you something. It usually needs a little adjusting but it gets me 90% of the way there and saves me a bit of time.
I rarely use it for much else but its a jq winner :)