mirror of
https://github.com/ynqa/jnv.git
synced 2025-12-30 15:39:59 -06:00
f0911d2e17e54ee1a7342f83d5926d75855a8a83
jnv is designed for navigating JSON,
offering an interactive JSON viewer and jq filter editor.
Features
- Interactive JSON viewer and
jqfilter editor- Syntax highlighting for JSON
- Use jaq to apply
jqfilter- This eliminates the need for users to prepare
jqon their own
- This eliminates the need for users to prepare
- Configurable features via TOML configuration
- Toggle hint message display
- Adjust UI reactivity (debounce times and animation speed)
- Editor appearance and behavior
- JSON viewer styling
- Adjust completion feature display and behavior
- Keybinds
- Capable of accommodating various format
- Input: File, stdin
- Data: A JSON or multiple JSON structures that can be deserialized with StreamDeserializer, such as JSON Lines
- Auto-completion for the filter
- Only supports:
- Hint message to evaluate the filter
Installation
Homebrew
See here for more info.
brew install jnv
Or install via Homebrew Tap:
brew install ynqa/tap/jnv
MacPorts
See here for more info.
sudo port install jnv
Nix / NixOS
See package entry on search.nixos.org for more info.
nix-shell -p jnv
conda-forge
See here for more info.
pixi global install jnv
# or
cat data.json | pixi exec jnv
# or
conda install jnv
Docker
Build (In the near future, the image will be available on something of registries)
docker build -t jnv .
And Run (The following commad is just an example. Please modify the path to the file you want to mount)
docker run -it --rm -v $(pwd)/debug.json:/jnv/debug.json jnv /jnv/debug.json
Cargo
cargo install jnv
Examples
cat data.json | jnv
# or
jnv data.json
Keymap
| Key | Action |
|---|---|
| Ctrl + C | Exit |
| Ctrl + Q | Copy jq filter to clipboard |
| Ctrl + O | Copy JSON to clipboard |
| Shift + ↑, Shift + ↓ | Switch to another mode |
Editor mode (default)
| Key | Action |
|---|---|
| Tab | Enter suggestion |
| ← | Move cursor left |
| → | Move cursor right |
| Ctrl + A | Move cursor to line start |
| Ctrl + E | Move cursor to line end |
| Backspace | Delete character before cursor |
| Ctrl + U | Clear entire line |
| Alt + B | Move the cursor to the previous nearest character within set(.,|,(,),[,]) |
| Alt + F | Move the cursor to the next nearest character within set(.,|,(,),[,]) |
| Ctrl + W | Erase to the previous nearest character within set(.,|,(,),[,]) |
| Alt + D | Erase to the next nearest character within set(.,|,(,),[,]) |
Suggestion in Editor (after Tab)
| Key | Action |
|---|---|
| Tab, ↓ | Select next suggestion |
| ↑ | Select previous suggestion |
| Others | Return to editor |
JSON viewer mode
| Key | Action |
|---|---|
| ↑, Ctrl + K | Move up |
| ↓, Ctrl + J | Move down |
| Ctrl + H | Move to last entry |
| Ctrl + L | Move to first entry |
| Enter | Toggle fold |
| Ctrl + P | Expand all |
| Ctrl + N | Collapse all |
Usage
JSON navigator and interactive filter leveraging jq
Usage: jnv [OPTIONS] [INPUT]
Examples:
- Read from a file:
jnv data.json
- Read from standard input:
cat data.json | jnv
Arguments:
[INPUT] Optional path to a JSON file. If not provided or if "-" is specified, reads from standard input
Options:
-c, --config <CONFIG_FILE> Path to the configuration file.
--default-filter <DEFAULT_FILTER> Default jq filter to apply to the input data
-h, --help Print help (see more with '--help')
-V, --version Print version
Stargazers over time
Languages
Rust
98.3%
Dockerfile
1.7%
