[HN Gopher] Show HN: Jless, a command-line JSON viewer ___________________________________________________________________ Show HN: Jless, a command-line JSON viewer Hey, Hacker News! Today I'm proud to release jless, a command-line JSON viewer. jless provides a JSON viewing experience similar to what you see in a browser's network tab in the developer console, but from the comfort of your terminal, with a whole suite of vim- inspired key bindings to easily manipulate your view of the data and full-text regex search. I'm sure many of you have some piped together some combination of cat, jq and less before; hopefully jless can replace that usage (hence the name). It supports newline delimited JSON too, so it can handle any output from jq. I built jless to solve a problem I kept facing while building plaintextsports.com [1][2]. For the live data I use a lot of public, but undocumented APIs, and I was constantly digging through giant JSON files to understand how the data was structured. I tried installing multiple Chrome extensions, but was dissatisfied with all of them. I piped files through jq into less a lot, and that was ok, but not great. The Preview pane in the Network tab of Chrome's dev tools was pretty useful, and I modeled a lot of jless's behavior and appearance off of that, but it didn't fit well into my tmux + vim dev environment, and I couldn't easily use it to inspect files on disk. I wanted that experience, but in my terminal (and with search support). Once I had built a rudimentary version of jless a few months ago, I immediately started using it whenever I was debugging something, and my usage has only grown as I've added more basic functionality. I've finally added all the features I feel like it needs to be functional, useful, and reliable. There's definitely more features I want to add: Windows support, some way to filter data with jq filters (a la fx [3]), yanking objects to the clipboard, being able to hide keys entirely, streaming data in, so you can peek at the start of gigantic file, maybe a way to extract a schema from a file (like [4]), plenty of low-hanging fruit for performance. Support for different hierarchical data formats (YAML, TOML, XML) could be cool someday. I'm sure many people will ask for editing support, but sadly that is not something I plan on adding anytime soon. I also used this project as a chance to learn Rust (code style and design comments appreciated!), which I had only dabbled with before. For a command- line utility, this felt like an obvious choice: small binaries (~3mb), instant startup, and great performance without any effort (try searching for comma in a big file!). I hope you find it useful! [1]: https://plaintextsports.com, live sports scores in plain text, no ads, no tracking, no loading [2]: https://news.ycombinator.com/item?id=26310314 [3]: https://news.ycombinator.com/item?id=29861043 [4]: https://quicktype.io/typescript Author : CodeIsTheEnd Score : 34 points Date : 2022-02-09 15:41 UTC (2 days ago) (HTM) web link (pauljuliusmartinez.github.io) (TXT) w3m dump (pauljuliusmartinez.github.io) | alexmorse wrote: | This is great, especially for when I'm trying to digest a big | blob where I don't know exactly what the structure is already! | mcmm wrote: | Love it! It's nice that you can pipe to jless the same way you | would pipe to less. Super useful for navigating through kube | resources, eg: | | kubectl get pod mypod-0 -n namespace0 -o json | jless | danso wrote: | Glad I fought the reflex to jump straight into the comments with | "So how is this different than jq" and instead actually clicked | through to see the wonderful homepage that instantly answered my | question via animated GIF. I'm a sucker for trying out any new | CLI tool and this looks genuinely and immediately useful. Thanks! | eurasiantiger wrote: | Homebrew? | CodeIsTheEnd wrote: | That's certainly the plan! I've never released a project like | this, so I wasn't sure what the process is for adding things to | Homebrew, or other package managers. A few people have been | really helpful and already added it to Arch Linux and NetBSD's | package managers. | | This week I just wanted to get the project out there to see if | people liked it, so I compiled stuff locally and manually | uploaded them to the GitHub releases page. I'll spend some time | over the next few weeks figuring out how to automate a lot of | these things. | andrewjluo wrote: | Relied on this a lot while working on a web scraping project! | Crazy useful for quickly parsing long JSON responses. | mimslee32 wrote: | Such a dope and useful tool, gonna be using it a bunch :) | ccakes wrote: | Nice! I've been using jsonfui[1] which does something similar but | will definitely give this a go | | [1] https://github.com/AdrianSchneider/jsonfui | veganjay wrote: | Very nice! I also thought "how is this different than jq" - glad | I clicked on the link - this will be very helpful in my toolset! | Thanks! | [deleted] | cyrdax wrote: | ive used this. its awesome!! | g105b wrote: | This is a lovely product. I would like to use it and compare to | jq, which I already use to query the contents of a JSON structure | from the CLI. | TheDong wrote: | > This is a lovely product | | It's a lovely project, a lovely tool. | | I think calling it a "product" devalues it, implies it's being | used to sell something or exploit its users. ___________________________________________________________________ (page generated 2022-02-11 23:00 UTC)