# 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
```bash
# Interactive TUI mode
jarq data.json
# Non-interactive mode (like jq)
```
In interactive mode, type filter expressions and see results in real-time.
## Keyboard Controls
### Navigation Mode
| `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 |
| `r` | Toggle raw output |
| `o` | Toggle compact output |
| `y` | Copy filter as jq command |
| `q`, `Esc` | Quit |
| `Ctrl-H` | Show help |
### Filter Edit Mode
| `Esc` | Exit filter edit mode |
| `Ctrl-P` | Toggle pause/resume evaluation |
| `Ctrl-C` | Cancel running evaluation |
| `Enter` | Evaluate now (when paused) |
| `Ctrl-S` | Toggle slurp mode |
| `Ctrl-R` | Toggle raw output |
| `Ctrl-O` | Toggle compact output |
| `Ctrl-Y` | Copy filter as jq command |
| `Ctrl-H` | Show help |
### 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 (suppress errors)
.[0] # array index
.[-1] # negative index (from end)
.[2:5] # array slice
.[:-1] # slice (all but last)
.[] # iterate all elements
.[]? # optional iterate
.foo.bar # chaining
# Construction
[.a, .b] # array
{name: .foo} # object
{(.key): .val} # dynamic key
```
## Builtins
`length`, `keys`, `values`, `type`, `first`, `last`, `reverse`, `sort`, `min`, `max`, `unique`, `flatten`, `add`, `empty`, `not`
## Building
```bash
cargo build --release
```
## License
MIT