jarq 0.2.0

An interactive jq-like JSON query tool with a TUI
Documentation
jarq-0.2.0 has been yanked.

jarq

An interactive jq-like JSON query tool with a TUI.

Should you use this instead of jq? Definitely not, this was just an experiment using a TUI and live filtering.

Usage

# Interactive TUI mode
echo '{"name": "Alice", "age": 30}' | jarq
cat data.json | jarq
jarq data.json

# Non-interactive mode (like jq)
echo '{"name": "Alice"}' | jarq '.name'
jarq '.items[]' data.json

In interactive mode, type filter expressions and see results in real-time.

Keyboard Controls

Navigation Mode

Key Action
i, / Enter filter edit mode
j, Scroll down
k, Scroll up
g Go to top
G Go to bottom
Ctrl-D Page down
Ctrl-U Page up
s Toggle slurp mode (treat input as single array)
q, Esc Quit
Ctrl-H Show help

Filter Edit Mode

Key Action
Esc Exit filter edit mode
Ctrl-P Toggle pause/resume background evaluation
Ctrl-C Cancel running evaluation (enters pause mode)
Enter Evaluate filter on demand (when paused)
Ctrl-H Show help (with builtin reference)

Background Evaluation

jarq evaluates filters in the background as you type. For large files, you can:

  • Pause evaluation (Ctrl-P): Stop auto-evaluation while you compose a complex filter
  • Cancel evaluation (Ctrl-C): Stop a long-running evaluation and enter pause mode
  • Evaluate on demand (Enter): When paused, manually trigger evaluation

When paused, the filter is still validated for syntax errors in real-time.

Filter Syntax

.               # identity
.foo            # field access
.foo?           # optional field (no error if missing)
.[0]            # array index
.[-1]           # negative index (from end)
.[2:5]          # array slice
.[]             # iterate all elements
.foo.bar        # chaining
.foo | length   # pipes

# Construction
[.a, .b]        # array
{name: .foo}    # object
{(.key): .val}  # dynamic key

# Operators
==, !=, <, >, <=, >=   # comparison
and, or, not           # logical
+, -, *, /, %          # arithmetic
// value               # alternative (default if null)

Builtins

Array/Object

length, keys, values, has(key), in(obj), contains(x), inside(x)

Array Operations

first, last, nth(n), reverse, sort, sort_by(path), group_by(path), unique, unique_by(path), flatten, flatten(depth), min, max, min_by(path), max_by(path), add, any, all, range(n), range(from;to)

String Operations

split(sep), join(sep), test(regex), match(regex), ltrimstr(s), rtrimstr(s), startswith(s), endswith(s), ascii_downcase, ascii_upcase, tostring, tonumber

Object Operations

to_entries, from_entries, with_entries(f), map(f), map_values(f), select(cond), recurse, recurse(f), walk(f), paths, leaf_paths, getpath(path), setpath(path;val), delpaths(paths)

Type

type, isinfinite, isnan, isnormal, infinite, nan, null, true, false, empty, error(msg)

Math

floor, ceil, round, sqrt, fabs

Other

debug, env

Building

cargo build --release

License

MIT