MyGit

ynqa/jnv

Fork: 56 Star: 5122 (更新于 2024-12-20 08:40:50)

license: MIT

Language: Rust .

Interactive JSON filter using jq

最后发布版本: v0.4.1 ( 2024-09-25 19:29:04)

GitHub网址

Text describing the image

ci

jnv is designed for navigating JSON, offering an interactive JSON viewer and jq filter editor.

jnv.gif

Inspired by jid and jiq.

Features

  • Interactive JSON viewer and jq filter editor
    • Syntax highlighting for JSON
    • Use jaq to apply jq filter
      • This eliminates the need for users to prepare jq on their own.

[!IMPORTANT] Starting from v0.3.0, the transition from libjq Rust binding j9 to jq clone jaq was made.

This change eliminated the need to manage C-related dependencies that include external tools like autoconf, thus simplifying the build process. However, please note that some filters are not yet supported by jaq. For more details, refer to GitHub issue #24.

Please continue to provide feedback regarding this transition.

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 jnv
Tab jq filter auto-completion
Move the cursor one character to the left
Move the cursor one character to the right
Ctrl + A Move the cursor to the start of the filter
Ctrl + E Move the cursor to the end of the filter
Backspace Delete a character of filter at the cursor position
Ctrl + U Delete all characters of filter
, Ctrl + K Move the cursor one entry up in JSON viewer
, Ctrl + J Move the cursor one entry down in JSON viewer
Ctrl + H Move to the last entry in JSON viewer
Ctrl + L Move to the first entry in JSON viewer
Enter Toggle expand/collapse in JSON viewer
Ctrl + P Expand all folds in JSON viewer
Ctrl + N Collapse all folds in JSON viewer
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(.,|,(,),[,])
Ctrl + O Copy current JSON content to clipboard
Ctrl + Q Copy current query to clipboard

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:
  -e, --edit-mode <EDIT_MODE>
          Edit mode for the interface ('insert' or 'overwrite'). [default: insert]
  -i, --indent <INDENT>
          Number of spaces used for indentation in the visualized data. [default: 2]
  -n, --no-hint
          Disables the display of hints.
  -d, --expand-depth <JSON_EXPAND_DEPTH>
          Initial depth to which JSON nodes are expanded in the visualization. [default: 3]
  -s, --limit-length <JSON_LIMIT_LENGTH>
          Limit length of JSON array in the visualization. [default: 50]
  -l, --suggestion-list-length <SUGGESTION_LIST_LENGTH>
          Number of suggestions visible in the list. [default: 3]
  -h, --help
          Print help (see more with '--help')
  -V, --version
          Print version

Stargazers over time

Stargazers over time

最近版本更新:(数据更新于 2024-10-09 11:16:13)

2024-09-25 19:29:04 v0.4.1

2024-08-13 17:57:38 v0.4.0

2024-06-02 19:48:12 v0.3.0

2024-05-26 17:19:45 v0.2.3

2024-04-21 19:18:04 v0.2.2

2024-03-29 23:47:05 v0.2.1

2024-03-25 19:23:39 v0.2.0

2024-03-24 10:49:23 v0.1.3

2024-03-21 21:47:48 v0.1.2

2024-03-20 10:05:07 v0.1.1

主题(topics):

autocomplete, cli, command-line, interactive, jq, json, kubernetes, prompt, rust

ynqa/jnv同语言 Rust最近更新仓库

2024-12-20 08:47:07 lapce/lapce

2024-12-19 20:41:09 tw93/Pake

2024-12-19 19:31:32 dashpay/platform

2024-12-18 10:31:25 DioxusLabs/dioxus

2024-12-17 17:18:34 lanyeeee/jmcomic-downloader

2024-12-16 23:19:51 meilisearch/meilisearch