7 ms·
Jqp – A TUI playground for exploring jq
- sadjad 4y agoVery nice! For something quick and dirty (and `apt-get install`able), I usually use jq+fzf like this: https://gist.github.com/reegnz/b9e40993d410b75c2d866441add2cb55 https://gist.github.com/reegnz/b9e40993d410b75c2d866441add2c...
- HellsMaddy 4y agoThis is awesome! I sometimes use jiq for this purpose, but I don't like that it tries to evaluate the query as you type, pressing enter exits the interactive session, and that you can't see the source and output at the same time. Jid has similar issues. Jqp seems to solve all of these problems, plus it has syntax highlighting. I'm going to use this tool all the time.
- TakeBlaster16 4y agoI've played with jid in jiq and IIRC they were very slow with large inputs since they re-parse the JSON blob every time the query changes. I wonder if this solves that problem--I'll bookmark it and find out next time I need to wrangle some JSON!
- ngorstein 4y agowow, thanks so much for the kind words! Didn't think people would see this, let alone for it to show up on Hacker News haha. Hope you get a lot of use out of it!
- HellsMaddy 4y agoA feature that would be cool: I often write some pretty complex jq queries. Once a query starts getting complex, I like to spread it over multiple lines for better readability. It would be cool if Jqp would let me insert newlines by pressing Shift+Enter.
- ngorstein 4y agoYeah for sure! Initially I had tried to do something like this, hit a roadblock and just went with the 1 line input in order to get a v1 out. Definitely something I'd consider as I continue to iterate on it.
- snidane 4y agoAnother useful json explorer TUI - jless. https://jless.io/ https://jless.io/
- medv 4y agoAnd https://fx.wtf https://fx.wtf
- flurie 4y agoI had fun writing a tree-sitter grammar[1] for jq, mostly based on the gojq parser. I realized it was probably in pretty good shape when a snippet that I thought was valid had a syntax error, which tree-sitter was happy to confirm. jq is a lot of fun to write and think with, and the stdlib is good but quirky. It would really benefit from some more libraries, so it's great to see tools to facilitate writing in it! [1] https://github.com/flurie/tree-sitter-jq https://github.com/flurie/tree-sitter-jq
- noxvilleza 4y agoWhat would be really awesome (although likely means ripping apart jq) would be some intermediate query caching. I often browse through large-ish (~1-2GB) JSON files and do something similar to the example animation in that I repeatedly filter and look for something. It would be awesome if it were smart enough to reasonable cache "filter A" when later reasoning about "filter A and filter B". Still really great as-is, will definitely use it.
- saulpw 4y agoHave you tried VisiData for this?
- noxvilleza 4y agoI have not, but I will investigate - cheers!
- togaen 4y agoI don’t know what any of those words mean.
- martyvis 4y agojq is a tool that can query (search/extract/format) JSON (JavaScript readable data files). I figured from the README that TUI probably stands for Text User Interface as it seems to support keystrokes in a way that an editor like Vi or Emacs work in a terminal (yeah I hadn't of it either, but I guess it is a retro acronym from GUI which is more well known)
- opan 4y agoTUI is anything sorta graphical and interactive in a terminal. Often but not always ncurses stuff.
- ZeroGravitas 4y agoAnd 'playground' often refers to interactive code environments, like this one for trying out tree-sitter parsing: https://tree-sitter.github.io/tree-sitter/playground https://tree-sitter.github.io/tree-sitter/playground
- tambourine_man 4y agoI’m loving this resurgence of TUI apps. Only now the quality and cross compatibility is much better than in the 90’s. Keep ‘em coming.
- John23832 4y agoWow cool. This really makes me want TUIs for many other clis.
- pawelduda 4y agoWhen I am hacking something relatively simple together, I tend to do: echo '' | fzf --preview 'jq {q} < filename.json' This approach can be generalized to other tools, to some extent: https://github.com/pawelduda/fzf-live-repl https://github.com/pawelduda/fzf-live-repl
- AviationAtom 4y agoYou kind of blew my mind with this simple concept. Going to see if I can incorporate it in my #kitbag
- ngorstein 4y agoOh woah, love this. Thanks for sharing. Will definitely be giving it a try.
- winter_squirrel 4y ago
- anjanb 4y agocan you explain what exactly is happening here
- corney91 4y agofzf is an interactive tool for fuzzy-finding and will take input from stdin. For example, `ls | fzf` will allow you to search through a list of files in your working directory. It also has an optional preview pane that can be used to show the output of a command. In this case, the empty string is provided as input because we're not interested in selecting options. You can then type your jq filter in fzf's query box and the command will run against filename.json in the preview pane on every kepress (the {q} is your currently typed query).
- Fnoord 4y agoI use ijq [1], saves me a lot of time. [1] https://sr.ht/~gpanders/ijq/ https://sr.ht/~gpanders/ijq/
- AviationAtom 4y agoTUI = Training user environment?
- almog 4y agoTUI = Terminal User Interface
- wseqyrku 4y agoPlease include scoop installation for your tool. Sincerely, a lazy user on the Internet.