Navigate and search in jdig
This page covers working with a file open in jdig. To open one, see Get started with jdig. Every key is listed in Keyboard shortcuts.
Move through the tree
Section titled “Move through the tree”Press j and k, or Down and Up, to move. The details panel on the right follows the selected row.
- l, Right, or Enter expands an object or array and moves to its first child.
- h or Left collapses it, or moves to the parent.
- o expands the selected node and what it contains, up to 5 levels deep.
- O collapses everything and returns to the top.
The keys to page through the tree, jump to the top or bottom, and resize the tree panel are in Keyboard shortcuts.
An NDJSON file opens as a list of its records under $. A plain text file, or a .gz or .zst file, shows (empty).
Search
Section titled “Search”Press /, type the text, and press Enter. The tree expands to the first match, and matching rows are highlighted. Press n for the next match, and N or p for the previous one.
By default, the search finds the text in keys and values, ignoring the case of the letters A to Z. Start the search with a prefix to change that:
| Search for | Finds |
|---|---|
timeout |
timeout in keys and values |
k timeout |
timeout in keys only |
r err-\d+ |
Text that matches a regular expression, ignoring case |
On a large file, the status bar shows Searching… N%. Press Esc to stop; the matches found so far stay.
Run a query
Section titled “Run a query”Press :, type a query, and press Enter. A query that starts with $ is JSONPath; anything else is jq. The prompt shows which one it is.
:.orders[] | select(.status == "pending") | .idThe results replace the details panel, numbered, with how long the query took. Press : again to start a new query, or : and then Esc to clear the results and show the details panel again. On an NDJSON file, jq runs once per record; JSONPath needs a JSON file.
The results list shows at most 1,000 results, without saying when there were more. Narrow the query to see the rest.
Copy values and paths
Section titled “Copy values and paths”- y copies the selected node as JSON, exactly as written in the file.
- P copies its path, such as
$.orders[1].status.
Copying uses your desktop’s clipboard, so it does not work over SSH or in a terminal without a desktop session.