Jq's syntax is so arcane I can never remember it and always need to look up how to get a value from simple JSON.
Funny that everyone is linking the tools they wrote for themselves to deal with this problem. I am no exception. I wrote one that just lets you write JavaScript. Imagine my surprise that this extremely naive implementation was faster than jq, even on large files. $ cat package.json | dq 'Object.keys(data).slice(0, 5)' [ "name", "type", "version", "scripts", "dependencies" ] https://crespo.business/posts/dq-its-just-j…
A Faster Alternative to Jq
261–270 of 281 posts
Re: A Faster Alternative to Jq
#262Re: A Faster Alternative to Jq
#263Earlier quoted context omitted.
Funny that everyone is linking the tools they wrote for themselves to deal with this problem. I am no exception. I wrote one that just lets you write JavaScript. Imagine my surprise that this extremely naive implementation was faster than jq, even on large files. $ cat package.json | dq 'Object.keys(data).slice(0, 5)' [ "name", "type", "version", "scripts", "dependencies" ] https://crespo.business/posts/dq-its-just-j…
Thanks. Can you say more about why TypeScript with Deno is your scripting language of choice?
https://docs.deno.com/runtime/reference/std/
You can see in my other scripts in my dotfiles that between dax for shelling out and cliffy or commander.js as a CLI builder, TS is a great language for building little CLIs.
Re: A Faster Alternative to Jq
#264Earlier quoted context omitted.
I'm not GP, I use jq all the time, but I each time I use it I feel like I'm still a beginner because I don't get where I want to go on the first several attempts. Great tool, but IMO it is more intuitive to JSON people that want a CLI tool than CLI people that want a JSON tool. In other words, I have my own preconceptions about how piping should work on the whole thing, not iterating, and it always trips me up. Here'…
Trying to make a generic pipeline for json arrays because you don’t know the field names?
Re: A Faster Alternative to Jq
#265Re: A Faster Alternative to Jq
#266One problem I have not seen addressed by jq or alterataives, perhaps this one addresses it, is "JSON-like" data. That is, JSON that is not contained in a JSON file For example, web pages sometimes contain inline "JSON". But as this is not a proper JSON file, jq-style utilties cannot process it The solution I have used for years is a simple utility written in C using flex^1 (a "filter") that reformats "JSON" on stdin,…
Re: A Faster Alternative to Jq
#267Re: A Faster Alternative to Jq
#268[1]: https://github.com/micahkepe/jsongrep/releases/tag/v0.8.0
Re: A Faster Alternative to Jq
#269Jq's syntax is so arcane I can never remember it and always need to look up how to get a value from simple JSON.
Funny that everyone is linking the tools they wrote for themselves to deal with this problem. I am no exception. I wrote one that just lets you write JavaScript. Imagine my surprise that this extremely naive implementation was faster than jq, even on large files. $ cat package.json | dq 'Object.keys(data).slice(0, 5)' [ "name", "type", "version", "scripts", "dependencies" ] https://crespo.business/posts/dq-its-just-j…