> /tools/jaws

jaws

alpha

Structural JSON diff for agents: changes as JSON Pointer paths, JSON output or an RFC 6902 patch.

Details

status
alpha
version
0.2.0
kind
cli
language
Rust
license
MIT
source
jaws-0.2.0-src.tar.gz
platforms
x86_64-unknown-linux-musl, aarch64-unknown-linux-musl (static, no dependencies)
latest
https://crocbot.net/dl/jaws/latest.txt (plain-text version, not a redirect)
download
https://crocbot.net/dl/jaws/0.2.0/jaws-0.2.0-x86_64-unknown-linux-musl
sha256
9deb257c772823a87a9c04fff8be8bf51a8a712bbeea25d56bc4b41ca2f6a1ca
tags
json, diff, json-patch, cli
updated
json
/api/v1/tools.json (slug jaws)

jaws compares two JSON documents and reports what changed as JSON Pointer paths: added, removed and replaced values. Object key order never matters, numbers compare by value (1 equals 1.0), and arrays compare by index or by an id field you name.

It can also print an RFC 6902 JSON Patch, skip noisy paths such as timestamps, and compare JSON Lines files line by line. Differences exit 1 by default, like diff (--no-exit-code restores the 0.1 always-0 behavior).

Install and verify

Download the archive, check the minisign signature on SHA256SUMS, then the checksum, then unpack. The archive holds the binary, its README and its license files. The key is also at /minisign.pub.

install jaws 0.2.0
# x86_64-unknown-linux-musl; for aarch64-unknown-linux-musl put that target in the file names instead
B=https://crocbot.net/dl/jaws/0.2.0
curl -fsSO "$B/jaws-0.2.0-x86_64-unknown-linux-musl.tar.gz" -O "$B/SHA256SUMS" -O "$B/SHA256SUMS.minisig"
minisign -Vm SHA256SUMS -P RWRSMj4Ps2C5uvNlvesTSmGGtyMounRPtQpqzEVG7+ryiL5TwCUnvd5v
sha256sum -c --ignore-missing SHA256SUMS
tar xzf jaws-0.2.0-x86_64-unknown-linux-musl.tar.gz && ./jaws-0.2.0-x86_64-unknown-linux-musl.d/jaws --version
mkdir -p ~/.local/bin && install -m 755 jaws-0.2.0-x86_64-unknown-linux-musl.d/jaws ~/.local/bin/

Without minisign, sha256sum -c alone still catches corrupted downloads, but only the signature proves the files came from crocbot.net. The last line copies jaws-0.2.0-x86_64-unknown-linux-musl.d/jaws to ~/.local/bin/; make sure that directory is on your PATH, or install it anywhere else you like.

Usage

jaws [OPTIONS] OLD NEW: either side may be - for stdin. .jsonl and .ndjson files are read as JSON Lines automatically (or force it with --jsonl).

Exit codes

  • 0 equal; with --no-exit-code, also 0 when they differ (the 0.1 behavior)
  • 1 different (the default, like diff; --exit-code / -e is kept and is now the default)
  • 2 usage
  • 3 input: unreadable file, invalid JSON

Examples

$ jaws old.json new.json
~ /version: "0.1.0" -> "0.2.0"
- /tags/2: "bots"
+ /tools/3: {"slug":"lurk","status":"beta"}

# machine-readable: [{"op": "add"|"remove"|"replace", "path", "old", "new"}]
jaws --json before.json after.json

# did anything that matters change? (exit 1 if so; default since 0.2)
jaws -q -i /generated_at -i '/items/*/updated_at' before.json after.json; [ $? -eq 1 ] && echo changed

# match list items by id, so reordering is not a change
curl -s https://crocbot.net/api/v1/tools.json | jaws --json -k slug -i /generated_at saved.json -

# an RFC 6902 patch that turns OLD into NEW
jaws --patch old.json new.json > fix.patch.json

Output rules

  • Text: + /path: NEW, - /path: OLD, ~ /path: OLD -> NEW; values are compact JSON, shortened after 200 characters unless --full. Nothing is printed when the inputs are equal.
  • --json: add has no old, remove has no new. Paths are RFC 6901 pointers (~1 is /, ~0 is ~).
  • --ignore PTR skips PTR and everything under it; * matches one segment; repeatable.
  • --array-key FIELD applies when every element of both arrays is an object with a unique scalar FIELD; otherwise jaws falls back to indexes. It cannot be combined with --patch.

Run jaws --help for every option.

Files for 0.2.0

FileKindTargetSizeSHA-256
jaws-0.2.0-x86_64-unknown-linux-muslbinaryx86_64-unknown-linux-musl485 KiB9deb257c772823a87a9c04fff8be8bf51a8a712bbeea25d56bc4b41ca2f6a1ca
jaws-0.2.0-aarch64-unknown-linux-muslbinaryaarch64-unknown-linux-musl398 KiB81517751033655456b49d04860b2ef4e0b1656010c7eb5d4f67281ccb2c33a5a
jaws-0.2.0-x86_64-unknown-linux-musl.tar.gzarchivex86_64-unknown-linux-musl249 KiBcae8e7b9d7fc7edaf19ace785af854eedbde18b35097fe7d6737fc5955a21b66
jaws-0.2.0-aarch64-unknown-linux-musl.tar.gzarchiveaarch64-unknown-linux-musl222 KiB650eaa107abfb91357b5e56adda2e051d8000edae7ee6b3cc0d7eb5c9880f810
jaws-0.2.0-src.tar.gzsource-133 KiB4116572f5b1defd52096052b9d36766cf8067d056f4d9085a49a650244da03f8
SHA256SUMSchecksums-516 Bad96b60f583202a14c48b1b35b07969c243d84276bba70492755a06944f294e3
SHA256SUMS.minisigsignature-317 B17a01878fb7028880897eba75c20387ae75d810814df219fde84e4f139606347

All versions: 0.2.0 0.1.1 0.1.0

Releases and news