Installation
jlens comes in five forms that share one engine. Install the ones you need.
Command line
Each GitHub release has the jlens binary for
Linux (x86-64 and ARM64, static), macOS (Intel and Apple silicon) and Windows (x86-64), with a
SHA256SUMS file. Download the archive for your platform and put jlens on your PATH, or let
cargo binstall do it:
cargo binstall jlens-cli
From 0.6.0 on, each archive has a build attestation: a signed statement that the release workflow of this repository built it, from which commit. Check one with the GitHub CLI:
gh attestation verify jlens-0.37.0-x86_64-unknown-linux-musl.tar.gz --repo thkprado/jlens
Elsewhere, build it from source with Rust 1.88 or later and a C compiler:
cargo install jlens-cli # from crates.io
cargo install --git https://github.com/thkprado/jlens jlens-cli
cargo install --path crates/jlens-cli # from a checkout
$ jlens --version
jlens 0.37.0
On macOS and Linux, Homebrew installs the same binary from the tap
thkprado/homebrew-jlens (from 0.14.0 on), and
brew upgrade follows the releases:
brew install thkprado/jlens/jlens
On Windows, Scoop installs it from the bucket
thkprado/scoop-jlens (from 0.14.0 on), and
scoop update jlens follows the releases:
scoop bucket add jlens https://github.com/thkprado/scoop-jlens
scoop install jlens/jlens
In a JavaScript project, the same binary comes from npm, in the package jlens-cli (from
0.21.1 on):
npx jlens-cli --version # run it without installing
npm install --save-dev jlens-cli # or add it to the project; npm scripts then run `jlens`
jlens-cli runs the release binary for your platform, which npm installs from one of its
optional dependencies, jlens-cli-<os>-<cpu>, with no install script. Each run starts Node.js
first, which adds some tens of milliseconds. An install with --omit=optional leaves the binary
out, and so does a platform without a release binary (Windows on ARM64, for one): jlens then
says which package it looked for and exits with code 2.
With Docker or Podman, the container image ghcr.io/thkprado/jlens (from 0.14.0 on) runs the
static Linux binary, for linux/amd64 and linux/arm64, with nothing else in the image. It is
tagged with each version (0.37.0), each minor version (0.37) and latest. Give it -i to
read standard input, or mount the current directory on /work to read files:
echo '{"a": [1, 2]}' | docker run --rm -i ghcr.io/thkprado/jlens eval '$sum(a)'
docker run --rm -v "$PWD:/work" ghcr.io/thkprado/jlens eval -f rule.jsonata -i order.json
The image runs as an unprivileged user (UID 65532): add --user "$(id -u):$(id -g)" for files
that only you can read. It has a build attestation too:
gh attestation verify oci://ghcr.io/thkprado/jlens:0.37.0 --repo thkprado/jlens
Install the command through one channel. With more than one, the first jlens on the PATH
runs, whatever its version; inside npm scripts and npx, the project’s own jlens-cli comes
first. To see which one runs:
jlens --version
which -a jlens # Linux and macOS: every jlens on the PATH, the one that runs first
where.exe jlens # Windows
The CLI guide describes every command.
Rust crates
[dependencies]
jlens-core = "0.37" # the language: parsing, evaluation, functions, auditing
jlens-schema = "0.37" # optional: schema inference and the language service
serde_json = "1"
jlens-core depends on serde_json, indexmap, jlens-regress (a fork of regress) and a
few small crates. The
optional tracing feature adds tracing spans for evaluations; see
the audit guide. The crate guide shows how to use
the API.
Browser and JavaScript
The WebAssembly package is the npm package jlens-wasm, an ES module:
npm install jlens-wasm
From 0.6.0 on, the package is published with
provenance: its page on npmjs.com
links it to the commit and the workflow run that built it, and npm audit signatures checks it
in a project that depends on it.
To build it from a checkout instead, you need:
- the
wasm32-unknown-unknownRust target; - the
wasm-bindgenCLI, at the version inCargo.lock.
rustup target add wasm32-unknown-unknown
cargo install wasm-bindgen-cli --version <version in Cargo.lock> --locked
cargo xtask wasm # writes crates/jlens-wasm/pkg
The WebAssembly guide covers loading the module in browsers, bundlers and Node.js.
Python
The Python package is jlens on PyPI, from 0.17.0 on, for
CPython 3.10 and later:
pip install jlens
Each release has wheels for Linux (x86-64 and ARM64, glibc 2.28 or later and musl), macOS (Intel and Apple silicon) and Windows (x86-64): one for Python with the GIL, and one for free-threaded Python 3.15 and later. Elsewhere, and for free-threaded Python 3.14, pip builds the source distribution, which needs Rust 1.88 or later. The packages are published from the release workflow with attestations, which link each file to the commit and the workflow run that built it.
The Python guide shows how to use it, and how to build it from a checkout.
Java
The Java package is io.github.thkprado:jlens on
Maven Central, from 0.25.0 on,
for Java 25 and later. With Maven:
<dependency>
<groupId>io.github.thkprado</groupId>
<artifactId>jlens</artifactId>
<version>0.37.0</version>
</dependency>
With Gradle:
implementation("io.github.thkprado:jlens:0.37.0")
Its one JAR carries the native libraries of Linux (x86-64 and ARM64, glibc 2.28 or later and
musl), macOS (Intel and Apple silicon) and Windows (x86-64), and loads the one of the platform it
runs on. The package calls native code: start the JVM with
--enable-native-access=io.github.thkprado.jlens on the module path, or
--enable-native-access=ALL-UNNAMED on the class path, or Java prints a warning at first use.
The files on Maven Central are signed with the release key
D007C3464271F80C1C1DF11BF1B365D7F599090B, on keyserver.ubuntu.com.
The Java guide shows how to use it, and how to build it from a checkout.
This book
The documentation is an mdBook:
cargo install mdbook
mdbook serve docs # http://localhost:3000
cargo xtask doc-check # runs the examples and checks the links