🍿 Explore JSON with jless
Snacks (🍿) are my collection of recipes for solving problems. Often recorded (and cleaned up) from actual discussions where I'm involved in helping others with technical problems. Not all solutions are mine but I started collecting them in one place because you never know when you need one.
jless is a command-line JSON viewer designed for reading, exploring, and searching through JSON data.
As a web developer I deal with a lot of JSON outputs, especially when calling APIs. I've been using jq a lot when needing to manage those JSONs. Now, when I just need to read, examine and copy individual content from JSONs, I use jless which offers an interactive interface on the command line. You can move around with arrow keys or vim-style shortcuts and easily copy individual objects from within.
Give it a go!
Install it from your package manager (for example on Mac with brew install jless
) and run:
curl https://api.github.com/repos/PaulJuliusMartinez/jless/commits | jless
You can move around with arrow keys (up/down to move, left/right to expand/collapse) and for example copy a node you're at with yy
on to your clipboard. The User Guide has a ton of helpful commands. If you're a vim user, you'll be right at home and for others, it may take a moment to memorize.