Our great sponsors
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
HackerNews
macOS HackerNews client that aims to be a Mac-assed Mac app. Written in Swift + AppKit. (by goranmoomin)
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
I've really loved having jq at my disposal ever since learning about it, but I feel like it took the combination of it and gron [1] to just transform my debugging and JSON workflows.
1: https://github.com/TomNomNom/gron
Whoa, I didn't know this existed. This does seem to address a lot of what I want. I wish that were more prominently linked to from https://stedolan.github.io/jq/.
jq is nice, but the moment i need anything more complex than "pull this attribute out of bunch of objects" i vastly prefer spinning up an actual language runtime. or use a tool built around a language (e.g. https://github.com/borkdude/jet) rather than a language built around a tool.
A bit offtopic, but I don't see much people knowing/using the Algolia API[0]. It's much better to use than the HN official API[1], since it returns the whole tree data in one request.
Unfortunately (I guess this is a big reason why people don't use it), it doesn't sort the comments – if you need the orders, you'll have to parse HN HTML (or just use the official API).
Still just two requests (the HN site, the Algolia API) is much better than recursively requesting a hundred requests, so I use this approach in my client[2].
[0]: https://hn.algolia.com/api
[1]: https://github.com/HackerNews/API
[2]: https://github.com/goranmoomin/HackerNews
A bit offtopic, but I don't see much people knowing/using the Algolia API[0]. It's much better to use than the HN official API[1], since it returns the whole tree data in one request.
Unfortunately (I guess this is a big reason why people don't use it), it doesn't sort the comments – if you need the orders, you'll have to parse HN HTML (or just use the official API).
Still just two requests (the HN site, the Algolia API) is much better than recursively requesting a hundred requests, so I use this approach in my client[2].
[0]: https://hn.algolia.com/api
[1]: https://github.com/HackerNews/API
[2]: https://github.com/goranmoomin/HackerNews
I tend to use jq a lot. As others have said, sometimes jq can be hard to grasp. Often it requires multiple attempts to get the correct answer. To make it a little easier for me, I've written a helper function[0] that combines it with fzf[1] to run jq as a REPL on any json. It allows to incrementally alter your DSL without having to continually call jq. This is similar to jid/jiq but a little more powerful. It includes functions to change the preview to output raw, compact (or not), and some other things.
I didn't use jid/jiq because jid uses go-simplejson, which is nowhere near as powerful as jq, and jiq seemed very buggy when I used it and it felt like it was hacked together. Plus there was no where to change jq's arguments while running it.
I'm sure this function can be improved on, but this has been good enough for me so far.
Also, I run gojq[2] instead of jq. It is a drop-in replacement for jq but is written in Go, and has some improvements over jq such as bug fixes, support for yaml input, and it also provides more helpful error messages.
[0] https://github.com/hoshsadiq/dot_files/blob/master/zshrc.d/m...
If anyone is an emacs user and this sounds compelling, I recommend counsel-jq[0] for the sort of feedback loop described here.
[0]: https://github.com/200ok-ch/counsel-jq
Fairly simple script showing the jq, REST, and JSON trinity:
https://github.com/DaveJarvis/github-email/blob/master/githu...
Just sharing my take on that interactive jq (or anything else) repl:
https://github.com/kbd/setup/blob/master/HOME/bin/fzr
It's just an fzf wrapper that sets up temporary files and so on. It works really well; it's amazing all the things one can use fzf for.