# jnv — Interactive JSON Filter Using jq in Your Terminal > A terminal-based interactive JSON viewer and filter that lets you explore and query JSON data with live jq expression evaluation and instant feedback. ## Install Save as a script file and run: # jnv — Interactive JSON Filter Using jq in Your Terminal ## Quick Use ```bash # Install via Homebrew brew install ynqa/tap/jnv # Or via Cargo cargo install jnv # Pipe JSON and explore interactively cat data.json | jnv # Or open a file directly jnv large-response.json # Kubernetes example kubectl get pods -o json | jnv ``` ## Introduction jnv is an interactive terminal tool that combines a JSON viewer with a live jq filter editor. As you type jq expressions, jnv immediately shows the filtered results, making it far easier to build complex queries than running jq repeatedly from the command line. ## What jnv Does - Displays JSON data in a navigable, syntax-highlighted tree view - Provides a live jq expression editor with instant result preview - Supports piped input from any command (curl, kubectl, docker, etc.) - Handles large JSON files efficiently with streaming and lazy rendering - Offers autocompletion hints for jq expressions based on the data structure ## Architecture Overview jnv is a single Rust binary that reads JSON from stdin or a file, parses it into an internal tree structure, and renders a split-pane TUI. The top pane shows the jq filter input with autocomplete suggestions. The bottom pane displays either the full JSON tree or the filtered output. As the user types, jnv compiles and runs the jq expression against the data in real time using the jaq library (a Rust reimplementation of jq). The TUI is built with ratatui for cross-platform terminal rendering. ## Self-Hosting & Configuration - Install via Homebrew, Cargo, Nix, or download a prebuilt binary from GitHub Releases - No configuration files needed — works out of the box - Set the EDITOR environment variable to open the current filter in your preferred editor - Adjust terminal colors through standard TERM and color scheme settings - Pass --max-depth to limit initial tree expansion for deeply nested JSON ## Key Features - Real-time jq evaluation with sub-second feedback even on megabyte-sized JSON - Full jq syntax support including pipes, array slicing, object construction, and builtins - Autocomplete suggestions derived from actual keys in the loaded JSON - Keyboard-driven navigation with vim-style bindings for the tree view - Copy filtered output to clipboard or pipe it to another command ## Comparison with Similar Tools - **jq** — the standard CLI JSON processor, but non-interactive; jnv wraps jq with live feedback - **fx** — interactive JSON viewer with JavaScript expressions; jnv uses the more widely known jq syntax - **gron** — flattens JSON for grep; jnv preserves structure and supports full jq queries - **jless** — read-only JSON viewer; jnv adds filtering and expression building - **yq** — YAML/JSON processor; jnv focuses on interactive exploration rather than scripted transforms ## FAQ **Q: Does jnv require jq to be installed?** A: No. jnv bundles its own jq implementation (jaq) written in Rust. No external jq binary is needed. **Q: Can jnv handle very large JSON files?** A: Yes. It streams input and uses lazy rendering, handling files of tens of megabytes without issues. Extremely large files (100MB+) may have slower initial load times. **Q: Does jnv support YAML or other formats?** A: jnv is JSON-only. For YAML, convert to JSON first with a tool like yq before piping to jnv. **Q: Can I save my jq filter for reuse?** A: You can copy the final expression from the filter bar. jnv also maintains a session history you can scroll through with arrow keys. ## Sources - https://github.com/ynqa/jnv --- Source: https://tokrepo.com/en/workflows/asset-9a3eb191 Author: Script Depot