5 ms·
$ jq '.[] | messages | .thank_you' < strings.json wait, maybe it's... $ jq '. | .messages.thank_you' < strings.json darn it! how about $ jq '[].messages.tha
by switch007 2y ago
$ jq '.[] | messages | .thank_you' < strings.json
wait, maybe it's...
$ jq '. | .messages.thank_you' < strings.json
darn it! how about
$ jq '[].messages.thank_you' < strings.json
!??@@!
- LeoPanthera 2y agoFiguring out what garbage to type into jq is the best thing about ChatGPT.
- benkuykendall 2y agoFor some reason, I find it kinda funny you don't just ask the LLM to extract the values for you. Practically, your solution makes a lot of sense -- way fewer tokens, less likely to make weird one-off errors, can verify the response makes basic sense or re-use the code off-line or with sensitive data... But if I were watching Star Trek, they would definitely just ask the computer to grab the fields and it would be a done deal!
- LeoPanthera 2y agoI'm rarely just using jq once. It's almost always going into a script, often where I only have placeholder data to test it with. Plus, you know, I actually learn how jq works and will need to ask the Magic Sky Oracle less often, in the future.
- pxc 2y ago> Plus, you know, I actually learn how jq works What's wrong with the docs? Relatedly, do you actually look up every filter and argument used in your AI-generated sample code in the jq docs?
- deleted 2y ago[deleted]
- gcr 2y agojq's syntax is different, but well worth remembering. i have some flash cards if you'd like. a teensy amount of effort pays huge dividends with swiss knife software like this (and things like matplotlib, tar CLI options, etc)