1

Given a large-ish JSON, browse it interactively in terminal.

$ output_long_json
{"packages":[{"name":"ba... <fill up entire screen>

It is already possible with repeated invocation of jq:

$ output_long_json | jq ''
{
  "packages": [
    {...
<better, but it dives in depth-first and I don't see top-level elements>

$ outout_long_json | jq 'keys'
[
  "packages",
  "resolve",
  "target_directory",
  "version",
  "workspace_members",
  "workspace_root"
]
<OK, now I want to enter "resolve" and see what's here>

$ outout_long_json | jq '.resolve | keys'
...

But is there maybe TUI way?

Imagined:

$ output_long_json | json_browse
-----------
| /
|   packages 
| * resolve
|   target_directory
|   ...

-----------
| /resolve
| * nodes
|   keys

----------
| /resolve/nodes
| * [0]
|   [1]
|   [2]
...

2 Answers 2

2

Here are terminal programs for viewing JSON that I've come across, along with some features:

  • jless (Rust) (MIT) (3.9k stars)
    • Vim-inspired keybindings
    • regex search
  • fx (Go) (MIT) (16.8k stars)
    • streaming
    • color themes
    • preserves key order
    • preserves big numbers
    • reducer mode, supports JavaScript, Python, and Ruby syntax
    • jq filters
    • mouse support
  • json-tui (C++) (MIT) (271 stars)
    • small, 400 LOC
    • mouse support
  • jid (Go) (MIT) (6.6k stars)
    • "JSON incremental digger"
    • jq syntax
    • suggestion and autocompletion
  • tson (Go) (MIT) (132 stars)
    • archived, last updated in 2019
  • pyfx (Python) (MIT) (22 stars)
  • nvim-jqx (Lua) (MIT) (246 stars)
    • Neovim plugin
    • supports YAML
  • ijq (Go) (GPLv3)
    • interactive tool for viewing jq inputs and outputs
  • vim-jqplay (VimScript) (Vim license) (86 stars)
    • Vim plugin
    • interactive tool for viewing jq inputs and outputs
1
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Aug 5 at 8:31
2

In case anyone chances on this question from a search engine, I found an answer.

fx is a command-line utility that allows TUI-style interactive browsing of JSON data. You can fetch that package through NPM or download a binary from the link.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.