0

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]
...
1

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, privacy policy and cookie policy

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