Skip to content

Conversation

@X-sella
Copy link

@X-sella X-sella commented Sep 6, 2025

This PR adds a new package: jsonviewer

  • Interactive JSON tree viewer for Termux
  • Built with Python and Textual
  • Supports expanding/collapsing JSON nodes for easier navigation
  • Useful for developers and anyone working with JSON on Android/Termux

Package metadata:

Installation in Termux after merge:
pkg install jsonviewer

This package includes:

  • build.sh: Termux package build script
  • LICENSE: MIT license
  • README.md: Project description and usage
  • Source tarball: jsonviewer-1.0.0.tar.gz

Copy link
Member

@TomJo2000 TomJo2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't seem to find a package request for this project.
So I'll just go through an abbreviated version of the package request checklist below really quick.

Note

For future reference, please open a package request before spending the time to write a package build.

Package requests give us a heads up to evaluate if a package is suitable for packaging in the main Termux repositories.
https://github.com/termux/termux-packages/issues/new?template=02-package-request.yml
If you intend to package

Not all projects will meet out packaging guidelines.
In case this project does not, it may still be suitable for inclusion in the TUR

Packaging policy acknowledgement

  • The project is actively developed.

  • The project has existing packages and is "well known".

  • Licensed under an open source license.

  • Not available through a language package manager: pip, npm, cpan, cargo, etc.

  • Not taking up too much disk space (< 100MiB per architecture, exceptions can be made)

  • Not duplicating the functionality of existing packages.

  • Not serving hacking, malware, phishing, spamming, spying, ddos functionality.

  • I certify that I have read Termux Packaging Policy and understand that my request will be denied if it is found lacking.

This repository is not intended for packaging personal hobby projects.
The project Readme and license should also not be duplicated in the package directory.
Neither should a tarball.

The project also duplicates the functionality offered by jq or yq.
This does not require packaging by us.

@robertkirkman
Copy link
Member

@X-sella It seems like an interesting program, but isn't it very easy to get like this?

curl -O https://raw.githubusercontent.com/X-sella/jsonviewer/refs/heads/main/src/jsonviewer
chmod +x jsonviewer
pip install textual rich
./jsonviewer $PREFIX/share/glvnd/egl_vendor.d/50_mesa.json

but also, when I try those commands, I see this error,

╭──────────────────── Traceback (most recent call last) ─────────────────────╮
│ /data/data/com.termux/files/home/./jsonviewer:17 in compose                │
│                                                                            │
│   14 │                                                                     │
│   15 │   def compose(self) -> ComposeResult:                               │
│   16 │   │   # Tree with HTML entity expand/collapse markers               │
│ ❱ 17 │   │   tree = Tree("JSON", expand_symbol="&dtri;", collapse_symbol=" │
│   18 │   │   self._build_tree(self.data, tree.root)                        │
│   19 │   │   yield tree                                                    │
│   20                                                                       │
│                                                                            │
│ ╭────────────────── locals ───────────────────╮                            │
│ │ self = JSONTree(                            │                            │
│ │        │   title='JSONTree',                │                            │
│ │        │   classes={'-dark-mode'},          │                            │
│ │        │   pseudo_classes={                 │                            │
│ │        │   │   'focus',                     │                            │
│ │        │   │   'dark'                       │                            │
│ │        │   }                                │                            │
│ │        )                                    │                            │
│ ╰─────────────────────────────────────────────╯                            │
╰────────────────────────────────────────────────────────────────────────────╯
TypeError: Tree.__init__() got an unexpected keyword argument 'expand_symbol'

The above exception was the direct cause of the following exception:

TypeError: JSONTree(title='JSONTree', classes={'-dark-mode'}, 
pseudo_classes={'focus', 'dark'}) compose() method returned an invalid result;
Tree.__init__() got an unexpected keyword argument 'expand_symbol'

do you happen to know if that is an intended use that can be fixed, or is it only compatible with specific .json files?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants