Skip to main content

A Tabular Json Explorer

Project description

Tabular Json EXplorer

Navigate through complex json files by interactively building up a jq filter.

demo gif

Usage

tjex example.json

If no file is given, tjex will try to read json from stdin. You will start out in the table panel. Use the arrow keys to navigate around the table and press <return> to descend into the currently selected cell. The prompt at the bottom will update to show the current path. Use ESC or C-_ to undo prompt changes, i.e. to navigate back up the hierarchy.

M-o switches between the table panel and the jq prompt. The prompt accepts any valid jq filters. Changes are immediately reflected in the table panel. When you are done, exit with C-g.

For a full list of hotkeys, look at the example configuration in ~/.config/tjex/config.toml which is automatically generated upon first invocation of tjex.

Installation

Requirements

  • python ≥3.12
  • jq (or jaq, gojq)
  • If atuin is available, the current prompt can be appended to the history with M-<return>.

To use jaq or gojq, set jq_command in ~/.config/tjex/config.toml.

With pipx

pipx install tjex

or, to get the latest version directly from github:

pipx install git+https://github.com/knapheide/tjex.git

Configuration

The default location for the configuration file is ~/.config/tjex/config.toml. An example configuration is automatically created when tjex is run for the first time.

Key bindings

Key bindings can be customized as illustrated in the example configuration.

Key names are taken from the curses library's keyname function. To find the name of a key, press it in tjex and watch the log output:

# In one terminal:
tjex --logfile=tjex.log []
# In another terminal:
tail -f tjex.log
# Now in the first terminal, press the desired key and look for a line of the form
# DEBUG:tjex:key='...'

Alternatives

  • jless is a command-line json viewer that basically displays the indented and syntax-highlighted json file. To get a better overview of the structure, individual objects and arrays can be collapsed or expanded.
  • jnv provides an interactive jq prompt together with a jless-style viewer. However, the prompt is not updated when browsing through the viewer.
  • fx has an interactive mode with a prompt. This prompt appears to be limited to path expressions and only influences the cursor position in the displayed json file.
  • nushell's explore command displays data in a tabular form similar to tjex. It has a :try sub-command that provides a nushell prompt.

TODO

  • Separate persistent command history for TextEditPanel
  • Multi-line cells
  • Transpose TablePanel (without changing the underlying data)
  • Configurable number formatting
    • More precision for small numbers
    • Hexadecimal integers
  • Raw view
  • Per-panel dirty flag
  • Status message animation (for pending jq process)
  • Nix flake
  • Plain-text search in table
  • Handle large data sets more gracefully. Getting unusably slow is fine, but tjex should never lock up or run out of memory.
    • Option to abort switch from prompt to table. Currently, tjex waits for the jq call to finish and there is no way to abort.
    • Option to toggle between global / local formatting
  • --watch option to automatically re-run filter. Probably using watchdog.
  • Cleaner way to get up-to-date config into subprocess

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tjex-0.3.0.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tjex-0.3.0-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

Details for the file tjex-0.3.0.tar.gz.

File metadata

  • Download URL: tjex-0.3.0.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.6

File hashes

Hashes for tjex-0.3.0.tar.gz
Algorithm Hash digest
SHA256 94a36b84a457016f5df7106136201b09adac6b95a69aa22f82dc0a72ea4f47ae
MD5 e6ba3beb95877ea8f6ccb8d00ee23669
BLAKE2b-256 e007bd6486e7e4d8b08075617ddfb184a1380a9fea476413a479d4caf29c47c4

See more details on using hashes here.

File details

Details for the file tjex-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: tjex-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 23.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.6

File hashes

Hashes for tjex-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 930eec89f8002fa72bb808d4affbe52d8733c6681c9671235b09ac04d69cbc91
MD5 b1ad1d421a641d82c5dc92a8e9af149d
BLAKE2b-256 a1f19f1adb0d55b477dbbb33ec08ad4798916e988a48b1fdbe983f6588954f4e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page