Skip to main content

Terminal-based JSON & YAML viewer (TUI) for exploring and searching large files — fast, interactive, and privacy-first.

Project description

Twig Logo

Twig 🌿

PyPI version Supported Python versions Downloads License: MIT Buy Me A Coffee

Inspect. Navigate. Understand.

A modern, terminal-based explorer for JSON and YAML files. Built for developers who work with real data in real environments.

Twig Demo

What is Twig?

Twig is a high-performance terminal UI for exploring JSON and YAML files interactively. It turns deeply nested data into a navigable tree, letting you search, jump, and inspect complex structures without piping commands together or scrolling endlessly.

Twig is designed for understanding data, not editing it. It fills the gap between cat/less (no structure) and heavy IDEs (too slow/GUI-based), making it perfect for production logs, Kubernetes manifests, and large API responses.


Installation

Using uv (Recommended)

The modern, fast, and reliable way to install Python tools.

# 1. Install uv (if needed)
curl -LsSf https://astral.sh/uv/install.sh | sh

# 2. Install Twig
uv tool install twg

Other Methods

Click to show pipx or pip instructions

Using pipx

pipx install twg

Using pip

Note: Recommended only for virtual environments.

pip install twg

Uninstalling

uv tool uninstall twg

Usage

Explore a file:

twg data.json
# or
twg config.yaml

Fix broken JSON: Automatically repair common errors (trailing commas, unquoted keys) or sanitize NaN/Infinity values:

twg --fix bad.json -o clean.json

Pretty Print:

twg -p large.json

Controls & Cheat Sheet

Key Action Key Action
Navigation Actions
Arrow Keys Traverse Tree c Copy Path
/ Search (Global) y Copy Source
n / N Next / Prev Match t Toggle Theme
: Jump to path ? Help
q Quit

Key Features

  • 📂 Multi-Format: Native support for JSON and YAML.
  • 👀 Read-Only by Design: Safely explore production data, logs, and configs without accidental edits.
  • 🔍 Deep Search: Fast fuzzy search across keys and values (e.g. Pull matches imagePullPolicy).
  • 🧭 Tree-Based Navigation: Navigate large, deeply nested files without losing context.
  • 🎨 Themes: Includes Catppuccin Mocha (default) and Solarized Dark.
  • ⚡ Performance-Focused: Designed to handle large files efficiently with a low memory footprint.

Why Twig Exists

Many real-world files — API responses, K8s manifests, Terraform state — contain sensitive information. Pasting them into web-based viewers is a security risk.

Existing CLI tools like jq are powerful for transformation but can be unintuitive for interactive exploration. Twig focuses purely on the latter:

  • Runs entirely locally
  • Works well over SSH and headless environments
  • Optimized for reading, not mutation

Comparison

Tool Strength Limitation
jq Powerful transformations Steep learning curve for exploration
less / cat Simple and universal No structure awareness
Web viewers Visual and easy Privacy, size, and trust issues
Twig Interactive understanding Read-only, exploration-focused

Non-Goals

Twig is not:

  • An editor.
  • A replacement for jq.
  • A streaming log viewer.

Performance & Architecture

Twig is built using Textual and uses SQLite with FTS5 for indexing. This allows instant search and navigation even for large files.

Benchmarks:

File Size Load Time (Cold Start) Experience
< 10MB < 1s ⚡ Instant
50MB ~8s 🚀 Fast
90MB ~17s ✅ Usable
> 100MB 20s+ 🐢 Slower

Contributing

We welcome contributions! Please see CONTRIBUTING.md for architecture details and setup instructions.

Star History

Star History Chart

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

twg-2.1.4.tar.gz (2.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

twg-2.1.4-py3-none-any.whl (35.6 kB view details)

Uploaded Python 3

File details

Details for the file twg-2.1.4.tar.gz.

File metadata

  • Download URL: twg-2.1.4.tar.gz
  • Upload date:
  • Size: 2.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.14 {"installer":{"name":"uv","version":"0.9.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for twg-2.1.4.tar.gz
Algorithm Hash digest
SHA256 fb1dc0c62a97cfee5c92f411e8d5f92d1aa3324e27e4da421c8e2edf4f33b458
MD5 916925b09b2e7cc06dde2618a3daff1d
BLAKE2b-256 43da0574f92872c08fdd620c77f98a49c5778c57cecb165b5f0f0c891f5b67c9

See more details on using hashes here.

File details

Details for the file twg-2.1.4-py3-none-any.whl.

File metadata

  • Download URL: twg-2.1.4-py3-none-any.whl
  • Upload date:
  • Size: 35.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.14 {"installer":{"name":"uv","version":"0.9.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for twg-2.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 47b4117ac8b606e9956eeef880dc7044fe9a0714c60a556f46a99d336f897d1c
MD5 e147c3f3955a956f85dca00a25770bba
BLAKE2b-256 d8ea535aa5395802a545992c5b0898d48e8ea6f938b83d852c247bba2637344d

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