jless is a command-line JSON viewer

Overview

jless logo and mascot

jless is a command-line JSON viewer. Use it as a replacement for whatever combination of less, jq, cat and your editor you currently use for viewing JSON files. It is written in Rust and can be installed as a single standalone binary.

jless is under active development. I often stream development live on Twitch.

Features

  • Clean syntax highlighted display of JSON data, omitting quotes around object keys, closing object and array delimiters, and trailing commas.
  • Expand and collapse objects and arrays so you can see both the high- and low-level structure of the data.
  • A wealth of vim-inspired movement commands for efficiently moving around and viewing data.
  • Full regex-based search for finding exactly the data you're looking for.

jless currently supports macOS and Linux. Windows support is planned.

Installation

The releases contains links to the latest release. If you have a Rust toolchain installed, you can build from source by running cargo install jless.

Logo

The mascot of the jless project is Jules the jellyfish.

jless mascot

Art for Jules was created by annatgraphics.

License

jless is released under the MIT License.

Comments
  • binary name

    binary name

    Hi,

    As you already know I've imported a package into pkgsrc. During the night I got an e-mail from Japan pointing out that the command name conficts with the existing Japanease version of less.

    I need to rename the resulting binary during installation, which is no big deal but, thought I'd ask if you have any preferences regarding the name.

    opened by 0323pin 6
  • Feature Request: Press a key for

    Feature Request: Press a key for "path" to current element

    Just tried jless after seeing on hacker news -- would it be possible to add a way to output the path to a given element?

    e.g.

    This would be super helpful when inspecting through highly nested json packets.

    opened by klei22 6
  • Cannot use `/` to search when piped.

    Cannot use `/` to search when piped.

    This tool is glorious!

    But, I found a problem. If you pipe info to it, say from an aws cli: aws iam list-instance-profiles | jless for example, I cannot search.

    Hitting / immediately exits, which was surprising.

    Bug 
    opened by dkowis 6
  • feature request: add keyboard shortcut to toggle expansion

    feature request: add keyboard shortcut to toggle expansion

    This is obviously a personal preference, but I strongly prefer using the same keyboard shortcut to both collapse and expand. It's much easier for me than splitting them into two separate shortcuts.

    opened by aantn 5
  • Building jless for more architectures

    Building jless for more architectures

    There's a hackernews comment asking for musl versions of this binary: https://news.ycombinator.com/item?id=30310461

    Humble request: musl version

    Keeping a glibc chroot directory takes up a fair bit of space, leaving less space available > for other stuff.

    Whenever I try compiling Rust programs it exhausts the available space I have.

    Hence I am resorting to begging, starting now (because this program sounds potentially > very useful.) Please folks, if possible, include musl versions in addition to glibc. :)

    In the spirit of overdoing everything, this workflows file allows you to build a rust version of your binary for common tier 1 and tier targets, using rust-cross if necessary.

    Feel free to tweak the file as necessary.

    I forked the repo and ran the action on my fork, so you can see what passed and what didn't pass before using it:

    You can see how the run fared here: https://github.com/Takashiidobe/jless/actions/runs/1833862676/attempts/1

    And what versions of jless were created here (32 builds passed): https://github.com/Takashiidobe/jless/releases/tag/v0.7.1-test

    opened by Takashiidobe 4
  • Scrolling doesn't respond correctly to window resizing

    Scrolling doesn't respond correctly to window resizing

    Steps to reproduce

    1. Open a terminal
    2. Pass some data to jless
      • Enough that more than the screen height is needed to display
    3. Resize the height of the window
    4. Scroll to the bottom to observe the active line go off-screen

    Info

    • Reproduceable on current main (9ed0cbf1b702ba25107b6690c25e742c85e5cc10)
    • $ uname -a: Linux ai 5.16.11-arch1-2 #1 SMP PREEMPT Mon, 28 Feb 2022 10:17:30 +0000 x86_64 GNU/Linux

    Thanks for the great tool, and let me know if you want any more info! I use i3-gaps so resizing windows is pretty common (tiling WM and all)

    opened by LovecraftianHorror 3
  • cannot use `C+f/b/d/u` to page up/down

    cannot use `C+f/b/d/u` to page up/down

    Thank you for your great work! It is really enjoyable.

    I found that the movement commands of vim below are not working. Is it an omission or by design?

    [Control][b] - Move back one full screen
    [Control][f] - Move forward one full screen
    [Control][d] - Move forward 1/2 screen
    [Control][u] - Move back (up) 1/2 screen
    

    p.s. I know I can use PageUp and PageDown to achieve it but my keyboard doesn't have these keys😅

    Requires Website Update 
    opened by Ginhing 3
  • jless no longer handles window resizing in v0.7.2

    jless no longer handles window resizing in v0.7.2

    This is a regression from v0.7.1. jless seemingly no longer responds to SIGWINCH signals. Likely introduced in https://github.com/PaulJuliusMartinez/jless/pull/32.

    Bug 
    opened by PaulJuliusMartinez 3
  • Copy full path of specific element(s) ?

    Copy full path of specific element(s) ?

    After drilling down to a specific value, is it possible to copy the full path of that value? I can see it on the status line, but I can't see how you can extract the full path.

    opened by reckoner 3
  • Incorrect installation command for Arch linux

    Incorrect installation command for Arch linux

    The installation command in the README for Arch linux is pacman -U jless, but jless is not (yet!) in the main arch repositories. The link to the AUR is correct, but the pacman command cannot install from the AUR.

    Since using tools like yay/aurman etc. which do install from the AUR are not officially supported by arch, and arch users presumably know how to install from the AUR anyway, I'd recommend just keeping the link, and not giving an installation command, just a message like "Available in the AUR".

    Love the tool!

    opened by nickspoons 3
  • cargo build fail on M1 Mac Rust

    cargo build fail on M1 Mac Rust

    I got a error on cargo build:

    % sudo cargo install jless
    ... snip ...
    error[E0658]: or-patterns syntax is experimental
       --> /Users/user1/.cargo/registry/src/github.com-1ecc6299db9ec823/jless-0.7.1/src/app.rs:101:26
        |
    101 |                 KeyEvent(Key::Ctrl('c') | Key::Char('q')) => break,
        |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
    error[E0658]: or-patterns syntax is experimental
      --> /Users/user1/.cargo/registry/src/github.com-1ecc6299db9ec823/jless-0.7.1/src/jsonparser.rs:67:24
       |
    67 |         while let Some(JsonToken::Whitespace | JsonToken::Newline) = self.peek_token_or_eof() {
       |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
    error: aborting due to 2 previous errors
    For more information about this error, try `rustc --explain E0658`.
    error: failed to compile `jless v0.7.1`, intermediate artifacts can be found at `/tmp/cargo-installoCXkLq`
    Caused by:
      could not compile `jless`
    To learn more, run the command again with --verbose.
    

    How can I build this? Thank you for your help.

    opened by kjur 3
  • FYI: vulnerability in jless ecoysystem

    FYI: vulnerability in jless ecoysystem

    Hi,

    thanks for jless, quite interesting tool, as a matter of endorsement i share the vulnerabiliities found in the jless ecosystem using osv-scanner https://github.com/google/osv-scanner

    https://paste.rs/Zfa.rhtml

    opened by commandline-be 0
  • Make clipboard an optional feature

    Make clipboard an optional feature

    Mostly solves #84 No automatic detection of anything, but at least now (or starting next release) I'll be able to build it on servers :) Let me know what you think @PaulJuliusMartinez

    opened by GPery 0
  • Customizable key bindings

    Customizable key bindings

    For users with a non-standard keyboard (e.g. dvorak), the default vim key bindings are not great.

    It would be awesome to be able to remap them, ideally in a config file.

    Ideas:

    • Either as letter-to-letter, e.g. "remap t j" makes "t" go down (like vim nnoremap)
    • Or as letter to command name, e.g. "map t moveDown": overwrites the current (if any) shortcut for "t" to do the action "moveDown". There would be a default mapping for "j" to "moveDown".
    opened by nitnelave 0
  • Handle compressed files

    Handle compressed files

    Hey!

    It would be nice to transparently handle compressed files, like json.gz or json.zstd. Either by guessing file type (with magic bytes?) or just by relying on the extension.

    Thanks!

    opened by vincentbernat 0
  • Bump clap to version 4.0

    Bump clap to version 4.0

    I'm back 😊

    Clap 4 drops the indexmap dependency, which is presumably good for the compile time.

    I also reformatted the longer help descriptions so they are cut off in short help mode jless -h, while also are printed in a more redable form for jless --help

    opened by tranzystorek-io 0
  • Spelling

    Spelling

    This PR corrects misspellings identified by the check-spelling action.

    The misspellings have been reported at https://github.com/jsoref/jless/commit/188d3fe6ea983390f86dea3f168a0199ddbae7db#commitcomment-88023872

    The action reports that the changes in this PR would make it happy: https://github.com/jsoref/jless/commit/23b5c00f31f89e498921c8eec8c32d6190addbb1

    Note: this PR does not include the action. If you're interested in running a spell check on every PR and push, that can be offered separately.

    opened by jsoref 0
Releases(v0.8.0)
  • v0.8.0(Mar 10, 2022)

    This new release of jless ships with two major new features: basic YAML support and copying to clipboard!

    jless will now check the file extension of the input file, and automatically parse .yml and .yaml files as YAML and use the same viewer as for JSON data. Alternatively passing in a --yaml flag will force jless to parse the input as YAML and can be used when reading in YAML data from stdin. (alias yless="jless --yaml" perhaps?) YAML aliases are automatically expanded, but their corresponding anchors are not visible, nor are comments. YAML supports non-string keys, and even non-scalar keys in mappings (e.g., the key of map can be an array with multiple elements). Non-string keys are shown with square brackets, e.g., [true]: "value", instead of quotes. Non-scalar keys are handled on the screen and displayed properly, but you cannot expand and collapse their individual elements.

    While navigating data, jless also now supports copying various items to your system clipboard.

    • yy will copy the value of the currently focused node, pretty printed
    • yv will copy the value of the currently focused node in a "nicely" printed one-line format
    • yk will copy the key of the current key/value pair
    • yp will copy the path from the root JSON element to the currently focused node, e.g., .foo[3].bar
    • yb functions like yp, but always uses the bracket form for object keys, e.g., ["foo"][3]["bar"], which is useful if the environment where you'll paste the path doesn't support the .key format, like in Python
    • yq will copy a jq style path that will select the currently focused node, e.g., .foo[].bar

    This release also includes a couple of new movement commands, and some stability fixes. The full list of changes can be seen below.

    Full list of changes

    New features:

    • Support displaying YAML files with autodetection via file extension, or explicit --yaml or --json flags.
    • Support copying values (with yy or yv), object keys (with yk), and paths to the currently focused node (with yp, yb or yq).
    • Implement ctrl-u and ctrl-d commands to jump up and down by half the screen's height, or by a specified number of lines.
    • Implement ctrl-b and ctrl-f commands for scrolling up and down by the height of the screen. (Aliases for PageUp and PageDown)

    Improvements:

    • Keep focused line in same place on screen when toggling between line and data modes; fix a crash when focused on a closing delimiter and switching to data mode.
    • Pressing Escape will clear the input buffer and stop highlighting search matches.

    Bug Fixes:

    • Ignore clicks on the status bar or below rather than focusing on hidden lines, and don't re-render the screen, allowing the path in the status bar to be highlighted and copied.
    • Issue #61: Display error message for unrecognized CSI escape sequences and other IO errors instead of panicking.
    • Issue #62: Fix broken window resizing / SIGWINCH detection caused by clashing signal handler registered by rustyline.
    • PR #54: Fix panic when using Ctrl-C or Ctrl-D to cancel entering search input.

    Other Notes:

    • Upgraded regex crate to 1.5.5 due to CVE-2022-24713. jless accepts and compiles untrusted input as regexes, but you'd only DDOS yourself, so it's not terribly threatening vulnerability.
    Source code(tar.gz)
    Source code(zip)
    jless-v0.8.0-x86_64-apple-darwin.zip(906.08 KB)
    jless-v0.8.0-x86_64-unknown-linux-gnu.zip(1012.86 KB)
  • v0.7.2(Feb 20, 2022)

  • v0.7.1(Feb 9, 2022)

  • v0.7.0(Feb 7, 2022)

    Introducing jless, a command-line JSON viewer.

    This release represents the significant milestone: a complete set of basic functionality, without any major bugs.

    This GitHub issue details much of the functionality implemented to get to this point. Spiritually, completion of many of the tasks listed there represent versions 0.1 - 0.6.

    The intention is to not release a 1.0 version until Windows support is added.

    Source code(tar.gz)
    Source code(zip)
    jless-v0.7.0-x86_64-apple-darwin.zip(1.02 MB)
    jless-v0.7.0-x86_64-unknown-linux-gnu.zip(1.80 MB)
Jq - Command-line JSON processor

jq jq is a lightweight and flexible command-line JSON processor. , Unix: , Windows: If you want to learn to use jq, read the documentation at https://

Stephen Dolan 23.9k Jan 4, 2023
command line tool to navigate JSON files with basic SQL-like queries

navi-json command line tool to navigate JSON files with basic SQL-like queries. The name plays with the assonance with the word 'navigator', at least

Giulio Toldo 2 Oct 2, 2022
Get JSON values quickly - JSON parser for Rust

get json values quickly GJSON is a Rust crate that provides a fast and simple way to get values from a json document. It has features such as one line

Josh Baker 160 Dec 29, 2022
JSON model for interacting with nftables' nft command

nftables-json Serde JSON model for interacting with the nftables nft executable Provides Rust types that map directly to the nftables JSON object mode

Alex Forster 3 Jan 8, 2023
JSON parser which picks up values directly without performing tokenization in Rust

Pikkr JSON parser which picks up values directly without performing tokenization in Rust Abstract Pikkr is a JSON parser which picks up values directl

Pikkr 615 Dec 29, 2022
Strongly typed JSON library for Rust

Serde JSON   Serde is a framework for serializing and deserializing Rust data structures efficiently and generically. [dependencies] serde_json = "1.0

null 3.6k Jan 5, 2023
JSON implementation in Rust

json-rust Parse and serialize JSON with ease. Changelog - Complete Documentation - Cargo - Repository Why? JSON is a very loose format where anything

Maciej Hirsz 500 Dec 21, 2022
Rust port of gjson,get JSON value by dotpath syntax

A-JSON Read JSON values quickly - Rust JSON Parser change name to AJSON, see issue Inspiration comes from gjson in golang Installation Add it to your

Chen Jiaju 90 Dec 6, 2022
rurl is like curl but with a json configuration file per request

rurl rurl is a curl-like cli tool made in rust, the difference is that it takes its params from a json file so you can have all different requests sav

Bruno Ribeiro da Silva 6 Sep 10, 2022
A rust script to convert a better bibtex json file from Zotero into nice organised notes in Obsidian

Zotero to Obsidian script This is a script that takes a better bibtex JSON file exported by Zotero and generates an organised collection of reference

Sashin Exists 3 Oct 9, 2022
A tool for outputs semantic difference of json

jsondiff A tool for outputs semantic difference of json. "semantic" means: sort object key before comparison sort array before comparison (optional, b

niboshi 3 Sep 22, 2021
Easily create dynamic css using json notation

jss! This crate provides an easy way to write dynamic css using json notation. This gives you more convenient than you think. Considering using a dyna

Jovansonlee Cesar 7 May 14, 2022
Decode Metaplex mint account metadata into a JSON file.

Simple Metaplex Decoder (WIP) Install From Source Install Rust. curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh Clone the source: git c

Samuel Vanderwaal 8 Aug 25, 2022
A node package based on jsonschema-rs for performing JSON schema validation

A node package based on jsonschema-rs for performing JSON schema validation.

dxd 49 Dec 18, 2022
CLI tool to convert HOCON into valid JSON or YAML written in Rust.

{hocon:vert} CLI Tool to convert HOCON into valid JSON or YAML. Under normal circumstances this is mostly not needed because hocon configs are parsed

Mathias Oertel 23 Jan 6, 2023
Typify - Compile JSON Schema documents into Rust types.

Typify Compile JSON Schema documents into Rust types. This can be used ... via the macro import_types!("types.json") to generate Rust types directly i

Oxide Computer Company 73 Dec 27, 2022
Tools for working with Twitter JSON data

Twitter stream user info extractor This project lets you parse JSON data from the Twitter API or other sources to extract some basic user information,

Travis Brown 4 Apr 21, 2022
A easy and declarative way to test JSON input in Rust.

assert_json A easy and declarative way to test JSON input in Rust. assert_json is a Rust macro heavily inspired by serde json macro. Instead of creati

Charles Vandevoorde 8 Dec 5, 2022
A fast way to minify JSON

COMPACTO (work in progress) A fast way to minify JSON. Usage/Examples # Compress # Input example (~0.11 KB) # { # "id": "123", # "name": "Edua

Eduardo Stuart 4 Feb 27, 2022