# 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 (treat input as single array) |
| `q`, `Esc` | Quit |
| `Ctrl-H` | Show help |
### Filter Edit Mode
| `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
.[0] # array index
.[-1] # negative index (from end)
.[] # iterate all elements
.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