Show HN: Jless, a command-line JSON viewer (pauljuliusmartinez.github.io)
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
90 comments
[ 129 ms ] story [ 1847 ms ] threadkubectl get pod mypod-0 -n namespace0 -o json | jless
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.
It was a pretty wonderful homepage right? I don't have any need for it now whatsoever, but this project looks like a useful debugging tool if you need to reverse engineer undocumented APIs. And the author's write up is comprehensive informative and well written. And their site looks good so this is an awesome Show HN I think.
Ed: like if you for a web app have selenium/browser tests that somehow also takes screenshots that become part of the documentation?
Not quite standard practice, though some people do bits of it here and there, but both probably should become so which would amortize the cost over lots of cli tools.
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.
[1] https://github.com/AdrianSchneider/jsonfui
I don’t get to interactively change the query, but hitting ‘q’ and running another jq query is in some sense more powerful, because it does not just allow me to “focus the lens” but also completely alter it.
Building a jq query by progressively testing and viewing is really nice. I love jq!
https://news.ycombinator.com/item?id=30275812
https://news.ycombinator.com/item?id=30280084
https://news.ycombinator.com/item?id=30277488
No, not here.
https://news.ycombinator.com/showhn.html
> Please don't ask friends to upvote or comment. That's not ok on HN.
https://news.ycombinator.com/newsfaq.html#ring
> Can I ask people to upvote my submission?
> No. Users should vote for a story because they personally find it intellectually interesting, not because someone has content to promote. We penalize or ban submissions, accounts, and sites that break this rule, so please don't.
> Can I ask people to comment on my submission?
> No, for the same reason. It's also not in your interest: HN readers are sensitive to this and will detect it, flag it, and use unkind words like 'spam'.
https://news.ycombinator.com/newsguidelines.html#:~:text=Ple....
Also, you can't cite the rules as some fake justification for your flouting the rules. Abusing the rules to pretend that, because the thing you, without proof, accuse someone of is disallowed, it somehow makes it OK for you to break the rules to post these disallowed accusations...is wrong. You're undermining the very thing you're merely pretending to support here. Which makes it seem like you never cared much for the rules in the first place, but only for some weird personal vendetta or whatever against this post. Whatever your reason, none of this is OK, on HN. Or anywhere really.
Please stop.
I appreciate the effort and good will
Why not use your real identity if you're so confident your claim is good?
That's pretty creepy and a bit disgusting to post that on someone's Show HN. Be a nicer human!
Tho.. Yeah... Sadly it does say something about how much HN can still improve it's response to Shows that people get so suspicious if there's too many positive comments and not enough negative ones--that they go looking for 'proof'.
The problem with that post is it's unnecessarily mean and you don't actually have any data to back up that claim, it's just speculation and a nasty one at that. It degrades the tone of discussion on a Show HN which is inappropriate, and is not what is aimed for here. If you feel there's an issue then email the mods, as they can take a look at the real data. Don't make baseless and cruel speculation on someone showing their work. Got it?
But messaging the mods to investigate is the better strategy.
I genuinely enjoyed the promo site and immediately installed the tool and tried it and loved it. Check my comment history if you like, not a bot or anything, just a normal programmer always in need of more tools to enable and improve his work.
It just degrades the discussion as seen here.
Also, pretty sure that Hacker News has automatic detection for fake comments so no need to do manual moderating I think.
I find json to be a PITA to parse as a human when looking at getting a bigger picture or keys/values that are strewn away from each other and not just e.g. two values next to each other. Anytime I have to do something with it, I have to search through my history to dig out some jq invocation and then try to tweak it correctly to do what the (most of the time similar but also different enough) task at hand needs. My mind sadly just seems to be unable to sufficiently grok jq.
So when I read here about jless I was stoked and the excitement was strong enough to want to dig out my login credentials and make a comment along the lines of "This is AWESOME! Thank you so much for making life easier!". In the end, when I logged in on the computer and had reflected more, I opted to upvote a comment instead and then saw this thread; so thank you, I guess, for providing me an opportunity or excuse to express my enthusiasm in addition to that.
I consider my discovery of jless (which sadly I was apparently not able to make on my own while searching the internet for json tools previously - so yay for lurking on HN :-) - but it might also partly be the relative (to my predicament) youth of the tool) of similar importance to me as macros in vim or back in the days using bluefish for editing HTML as they all save my time being spent on doing tooling to do things and instead allow it to being spent on doing things directly. (BTW thanks to all these devs!)
Just my 2 cents :-) (and I'm not particularly interested in starting or partaking in any further discussion)
Note that I did not use tweaks which require rust nightly, as I did not feel like installing it.
Yep, `jless` is exactly that kind of tool. Instant favourite, and love at first sight.
Extremely good job, thanks a lot for the tool!
don't know what's going on inside of espn but their web experience (mobile or not) is just terrible - and i don't bother with the app. was really looking for something like how simple yahoo sports was back in the day, and plaintextsports seems to be it.
If I could suggest one thing: ctrl-u and ctrl-d are pretty common shortcuts for page up and page down, they're even supported in Vim and less. It would make sense to add support for those in addition to the actual PageUp/PageDown keys.
I'm more of a ctrl-e/ctrl-y guy myself, so I didn't feel a need to implement these commands right away.
unrelated: this is my very first comment on HN, hurray!
[1] Chrome Web Store: https://chrome.google.com/webstore/detail/virtual-json-viewe...
[2] Github: https://github.com/paolosimone/virtual-json-viewer
Oh and welcome to HN :)