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 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
  • Publish to PyPI
  • 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.2.0b1.tar.gz (17.4 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.2.0b1-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

Details for the file tjex-0.2.0b1.tar.gz.

File metadata

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

File hashes

Hashes for tjex-0.2.0b1.tar.gz
Algorithm Hash digest
SHA256 0e356c1c5026c5ae18b19733c83a100b227cec7882df08e318886c5003664c03
MD5 ea79515fa9f5357ab2f24cd4b9e153c1
BLAKE2b-256 1cf50f50c962ea36f22bda10c4e3ea67e2f2cb51b6f67906867b1d0c955dee88

See more details on using hashes here.

File details

Details for the file tjex-0.2.0b1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for tjex-0.2.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 deb5b36862a3345875304535d3a49438e05cc785e58cca7075ee23e3fb0424e0
MD5 a9b556ae173e0c5bbb6ade2007f08e2e
BLAKE2b-256 ba651c539e78589b3e2624c5237b408f8674fefe1dc3cff2558c27af81a03957

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