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
  • 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.0b3.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.2.0b3-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tjex-0.2.0b3.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.2.0b3.tar.gz
Algorithm Hash digest
SHA256 31ec760379e3ba074e16e1d0edfc23da32bfc14be78e2befb19c1a8bf656e811
MD5 919ca80078497471deffea71362ed841
BLAKE2b-256 19ffbc03ca99fd0a9b1d474003b31b5ba31bd133b29e489c7dbc2a224f4006b9

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tjex-0.2.0b3-py3-none-any.whl
Algorithm Hash digest
SHA256 7c6b65a9304ba9eb190c7db53dd3185dc5316a1ca026243a3904a3f5a49a235c
MD5 0f33e97fe658c18f3879ef313adc1acd
BLAKE2b-256 0adbb02742d709859db6aaff2b11bd2b8c4a346369cf355042f43feeacd44444

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