lacspace-json

The friendly jq — query, patch, convert, canonicalize.

terminal
npx lacspace-json
What it does

Everything, in one command

lacspace-json gives you the 80% of jq you actually use — paths, select, map, sort_by, group_by, aggregates — plus first-class format conversion, JSON Schema validation, structural diff and deep merge, all behind one small binary with no dependencies. The query engine is a hand-written tokenizer→evaluator (no eval) and every object built from input is guarded against prototype pollution. Everything runs locally: no key, no account, no network, no telemetry.

Features

What's inside

Safe jq-style query

paths, pipes, select, map, sort_by, group_by, aggregates; no eval.

5-format convert

JSON ⇄ YAML ⇄ TOML ⇄ CSV ⇄ NDJSON with auto-detection.

JSON Schema validation

draft-07 subset with clear per-error paths, non-zero exit.

Structural diff

added/removed/changed with dotted/bracket paths, coloured or --json.

Deep merge

N documents, array strategy concat/replace/by-key.

Pipe-friendly

reads stdin, --raw unquoted scalars, --get shorthand, --min/--sort-keys.

Zero deps, fully typed

dual ESM+CJS library sharing the CLI engine.

JSONPath queries

$.store.book[*].price, recursive $..author, wildcards, slices and [?(@.price<10)] filters.

JSON Patch (RFC 6902)

Apply a patch or generate one from two documents; add/remove/replace/move/copy/test.

JSON Pointer (RFC 6901)

Resolve /a/b/0 addresses from CLI or library, with escape-aware parsing.

flatten / unflatten

Collapse to a { "a.b[0]": v } map and rebuild it, round-trip lossless.

Canonical JSON

Deep key-sort + minimal whitespace for stable hashing and reproducible diffs.

How to use

Copy, paste, done

Real commands and snippets — from a one-liner to the typed library.

Filter + project
terminal
cat users.json | lacspace-json -q '.users[] | select(.active) | .email' -r

jq-style query, unquoted for the shell.

TOML → YAML
terminal
lacspace-json convert config.toml --to yaml

Auto-detects input from the extension.

CSV → JSON
terminal
cat people.csv | lacspace-json convert --from csv --to json

Header row becomes object keys.

Validate
terminal
lacspace-json validate user.json --schema user.schema.json

Exits 1 with per-error paths if invalid.

Diff
terminal
lacspace-json diff old.yaml new.yaml

Works across formats too.

Merge by key
terminal
lacspace-json merge base.json patch.json --array by-key --array-key id

Matches array items by id.

JSONPath recursive
terminal
echo '{"store":{"book":[{"price":8.95},{"price":22.5}]}}' | npx lacspace-json -q '$..price'

$-style JSONPath with recursive descent.

Generate a JSON Patch
terminal
npx lacspace-json diff old.json new.json --patch

RFC 6902 patch that turns old into new.

Apply a JSON Patch
terminal
npx lacspace-json patch doc.json changes.json

add/remove/replace/move/copy/test ops.

Canonical JSON
terminal
npx lacspace-json sort data.json --canonical | shasum

Sorted keys, minimal whitespace for stable hashing.

Good for

What people build with it

✓ Explore & reshape API responses in the terminal

✓ Convert config between YAML/TOML/JSON in build scripts

✓ CI gate that validates data against a schema

✓ Review what changed between two config/data files

Start now

Run lacspace-json today

Free, open-source, no API keys. It's a CLI and a typed library.

terminal
npx lacspace-json