Mastering jq

https://codefaster.substack.com/p/mastering-jq-part-1-59c

28 points · 10 comments · view on lemmy.world

10 Comments

h4x0r@lemmy.dbzer0.com · 18 pts · 1y (2 replies)

The first step to mastery is RTFM: https://jqlang.org/manual/

cerement@slrpnk.net · 3 pts · 1y (1 reply)

oh hey, a project that actually has a manual to read

ArseAssassin@sopuli.xyz · 8 pts · 1y (1 reply)
[ removed ]
MonkderVierte@lemmy.zip · 3 pts · 1y

Both are bad. Make it readable.

And if you often resort to jq, better use python or at least something like nushell.

MRIG@slrpnk.net · 5 pts · 1y

If you're going to use jq to manipulate JSON I'd recommend a helper CLI tool like ijq. It allows you to experiment without needing too lines in your terminal history.

gramgan@lemmy.ml · 3 pts · 1y (1 reply)

I’m curious if anyone else has considered using nushell for these things? Probably not for everything (or to replace one’s shell) but it definitely is simpler for basic tasks.

slackness@lemmy.ml · 1 pts · 1y
[ removed ]
FishFace@lemmy.world · -9 pts · 1y (3 replies)

I asked an LLM to write a jq scriptlet for me today. It wasn't even complicated, it just beat working it out/trying to craft the write string to search Stackoverflow for.

beejjorgensen@lemmy.sdf.org · 3 pts · 1y (2 replies)

I tried and failed to get an LLM to write jq code to do a regex based matcher for finding if one json object was a subset of another.

Gave up and learned it enough to get it going. jq is nutso powerful.

FishFace@lemmy.world · 1 pts · 1y (1 reply)

I don't understand how regex comes into it? Sounds tricky though!

beejjorgensen@lemmy.sdf.org · 2 pts · 1y

Basically "does this JSON object contain at least these two properties, and is the value of one particular properties a string of digits followed by the letter 'Z'", for example.