How to Use the jless Command in Linux for Interactive JSON Viewing and Navigation

Working with large, deeply nested JSON payloads from command-line tools, database dumps, and API responses frequently overwhelms traditional terminal utilities. While piping into less or cat provides raw text pagination, it offers no understanding of JSON structure, while tools like jq focus on data manipulation rather than fluid interactive browsing. The jless command bridges this gap by providing an interactive command-line JSON pager written in Rust that understands JSON syntax, supports folding objects and arrays, colourises distinct data types, and enables rapid tree navigation.

Why Use jless Over Traditional Terminal Pagers?

Unlike standard text pagers, jless parses incoming data into an abstract syntax tree (AST) prior to rendering, delivering several unique advantages:

  • Structural Code Folding: Expand and collapse individual JSON objects, dictionaries, and arrays with a single keypress.
  • Data-Type Aware Highlighting: Distinctly colourises keys, string values, integers, floats, booleans, and nulls for effortless visual scanning.
  • Breadcrumb Path Navigation: Always shows the complete JSON path (e.g., .users[12].preferences.notifications) to your currently selected line at the bottom of the screen.
  • Copy Path to Clipboard: Instantly copy the exact jq-compatible object path to your system clipboard without manual transcription.

Installing jless on Linux Distributions

The jless binary is lightweight and can be installed via package managers or compiled directly via Cargo.

Installing via Cargo (Any Distribution)

If you have Rust installed, install jless directly from crates.io:

cargo install jless

Installing on Arch Linux

Arch Linux includes jless in the official extra repository:

sudo pacman -S jless

Installing via Pre-Compiled Release Binaries

On Debian, Ubuntu, or Fedora workstations, download the latest compiled binary tarball from GitHub releases:

curl -OL https://github.com/PaulJuliusMartinez/jless/releases/latest/download/jless-v0.9.0-x86_64-unknown-linux-gnu.zip
unzip jless-v0.9.0-x86_64-unknown-linux-gnu.zip
sudo mv jless /usr/local/bin/
rm jless-v0.9.0-x86_64-unknown-linux-gnu.zip

Viewing JSON Files and Pipelines with jless

To inspect a local JSON file, provide the file path as the first argument:

jless dataset.json

You can also pipe standard output directly from curl, xh, or Docker commands into jless:

curl -s https://api.github.com/repos/rust-lang/rust | jless

When input is piped, jless buffers and validates the stream before opening the interactive viewer interface.

Essential Navigation and Folding Shortcuts

Navigating large JSON trees in jless follows intuitive, vim-inspired keystrokes:

  • j / Down Arrow: Move cursor down one line.
  • k / Up Arrow: Move cursor up one line.
  • Space: Toggle folding (collapse or expand) on the currently selected object or array.
  • c: Collapse all children underneath the highlighted node.
  • e: Expand all children underneath the highlighted node.
  • h / Left Arrow: Jump up to the parent container object.
  • l / Right Arrow: Jump inside the first child element of an expanded object.

Searching by Keys and Values

Finding specific data in multi-megabyte files is fast with dedicated search modes:

  • /: Search across both keys and values. Type your query (supports regular expressions) and press Enter.
  • *: Search specifically for matching object keys.
  • #: Search specifically for matching values.
  • n: Jump to the next search match.
  • N: Jump to the previous search match.

Extracting and Copying Paths for jq

One of jless‘s most powerful capabilities is generating paths for downstream scripts:

  1. Navigate your cursor to any nested value within the JSON hierarchy.
  2. Look at the bottom status bar to view the canonical path (for example: .data.items[3].metadata.id).
  3. Press y + p to copy the exact path directly to your system clipboard.
  4. Paste that path directly into a jq query or your application code without guessing array index positions.

Adopting jless permanently upgrades your terminal JSON inspection workflows, saving significant time when debugging REST APIs and exploring complex nested data structures.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.