jq.node - Become a shell hero, get super-power
jq.node is JavaScript and Lodash in your shell (along with the 1.45M npm modules). It's a powerful command-line JSON/string processor. It so easy it feels like cheating your inner-bearded-sysadmin.
Sponsors
<table <tr <td align="center" width="175" <a href="https://france-nuage.fr/?mtmsource=github&mtmmedium=sponsor&mtmcampaign=france-nuage&mtmcontent=jq.node" <img src="assets/sponsors/france-nuage.svg" height="60" alt="France-Nuage"/<br/ <bFrance-Nuage</b </a<br/ <subSovereign French cloud for your JSON pipelines. Re-internalise anytime.</sub </td <td align="center" width="175" <a href="https://www.hook0.com/?mtmsource=github&mtmmedium=sponsor&mtmcampaign=hook0&mtmcontent=jq.node" <img src="assets/sponsors/hook0.png" height="60" alt="Hook0"/<br/ <bHook0</b </a<br/ <subShip webhooks with signed payloads & retries. Self-hosted option ready.</sub </td <td align="center" width="175" <a href="https://getnatalia.com/?mtmsource=github&mtmmedium=sponsor&mtmcampaign=natalia&mtmcontent=jq.node" <img src="assets/sponsors/natalia.svg" height="60" alt="Natalia"/<br/ <bNatalia</b </a<br/ <subStop missing prospect calls while you wrangle JSON. AI picks up 24/7.</sub </td <td align="center" width="175" <a href="https://netir.fr/?mtmsource=github&mtmmedium=sponsor&mtmcampaign=netir&mtmcontent=jq.node" <img src="assets/sponsors/netir.svg" height="60" alt="Netir"/<br/ <bNetir</b </a<br/ <subHire vetted French freelance backend devs or join the marketplace.</sub </td </tr <tr <td align="center" width="233" <a href="https://nobullshitconseil.com/?mtmsource=github&mtmmedium=sponsor&mtmcampaign=nbc&mtmcontent=jq.node" <img src="assets/sponsors/nobullshitconseil.svg" height="60" alt="NoBullshitConseil"/<br/ <bNoBullshitConseil</b </a<br/ <subTech advisory without the bullshit. Strategic clarity for execs.</sub </td <td align="center" width="233" <a href="https://qualneo.fr/?mtmsource=github&mtmmedium=sponsor&mtmcampaign=qualneo&mtmcontent=jq.node" <img src="assets/sponsors/qualneo.svg" height="60" alt="Qualneo"/<br/ <bQualneo</b </a<br/ <subQualiopi-ready LMS for French training organisations. 32 indicators.</sub </td <td align="center" width="233" <a href="https://recapro.ai/?mtmsource=github&mtmmedium=sponsor&mtmcampaign=recapro&mtmcontent=jq.node" <img src="assets/sponsors/recapro.png" height="60" alt="Recapro"/<br/ <bRecapro</b </a<br/ <subSovereign AI transcribes meetings & drafts the report. Stays private.</sub </td </tr </table
Interested in sponsoring? Get in touch
Rational
I'm a huge fan of jq but it was so many times inconsistent and irritating. It sometimes felt like JavaScript but it was not. jq.node is what jq should be in my opinion. First version was written in 25 lines of JavaScript code and was already way more powerful than jq, backed from day one by more than 300 helpers from Lodash FP.
Why jq.node? Why not jq?
- jq.node does not try to implement its own expression language, it's pure JavaScript
- no need to learn new operators or helpers, if you know lodash/fp, you know jq.node helpers
- more powerful than jq will ever be jqn 'filter(has("email")) | groupBy(u = u.email.split("@")[1]) | csv'
- through --require command option, jq.node leverages 1.45M npm modules. Hard to do more powerful than that!
Why jq? Why not jq.node?
- performance matters more than feature set (in our current implementation jq is faster than jq.node, C vs JavaScript)
- some features of jq are not currently implemented in jq.node
- jq is a binary, jq.node is a NodeJS project (🌟 accessible through a docker image)
Install (NodeJS)
$ npm install jq.node -g
$ echo '{"a": true}' | jqn 'o => o.a'
trueCLI Usage
# the 4 commands below do the same thing
cat users.json | jqn 'filter(has("email")) | groupBy(function(u){return u.email.split("@")[1]}) | csv'
cat users.json | jqn 'filter(has("email")) | groupBy(u => u.email.split("@")[1]) | csv'
cat users.json | jqn 'filter(has("email")) | groupBy(u => get(u.email.split("@"), 1)) | csv'
cat users.json | jqn 'filter(has("email")) | groupBy(flow(get("email"), split("@"), get(1))) | csv'- Complex and tricky JSON querying made easy with jq.node
- Editing string (to JSON) in clipboard with jq.node
Note: the pipe | must always be surrounded by space to be understood by jqn as a pipe.