Exploring JSON using JLESS on windows WSL

jq is a good tool for extracting data from JSON using cli, also it has binaries for windows if you search around.

But it doesn't scale well when you want to explore a big JSON object.

jless on the other hand is really good for navigating and exploring your JSON objects. But it doesn't have windows binaries.

That's where WSL come into play here.

Install WSL, then you can install jless like this

wget https://github.com/PaulJuliusMartinez/jless/releases/download/v0.8.0/jless-v0.8.0-x86_64-unknown-linux-gnu.zip
unzip jless-v0.8.0-x86_64-unknown-linux-gnu.zip
sudo mv jless /usr/local/bin/

Now you can use jless by typing jless and pressing enter.

to give it a quick test run this

echo '{"test": true}' | jless

If you see this, then jless worked

image.png

Now you can copy your json and run this line to get your json into jless automatically

powershell.exe -noprofile Get-Clipboard | jless

Also you can add this as an alias into your ~/.bash_profile like so

alias pj="powershell.exe -noprofile Get-Clipboard | jless"

I chose pj(paste into jless), because its easy to remember you can choose your own alias name.

Now you can just copy your JSON, open WSL and type pj and hit enter, and your JSON should be there ready for navigation.