npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

json-term

v1.2.0

Published

High-fidelity interactive terminal JSON viewer, collapsible tree explorer, type syntax highlighter, and structural diff tool.

Readme

json-term 🌳

CI npm version License: MIT Node.js TypeScript

High-fidelity interactive terminal JSON viewer, collapsible tree explorer, type syntax highlighter, and structural diff tool across macOS, Linux, and Windows.

Never drown in unformatted 5,000-line JSON outputs or fight with false-positive line diffs again. json-term lets you interactively collapse/expand nested objects, inspect JSONPaths, copy values to your clipboard, and perform key-order independent structural diffs directly inside your terminal.


✨ Features

  • 🌳 Interactive Collapsible Tree: Expand and collapse objects/arrays with Enter, Space, or arrow keys (▶ 25 items / ▼).
  • 🎨 Type-Aware Syntax Highlighting: Bold cyan keys, green strings, yellow numbers, magenta booleans, and dimmed nulls.
  • ⚡ Key-Aware Structural Diffing: Ignores arbitrary key order differences and visually highlights additions (+), removals (-), and mutations (~).
  • 🎯 1-Key JSONPath & Value Copying: Hit p to copy the node's JSONPath (data.users[0].address.city) or y to copy its formatted JSON value to the system clipboard.
  • 🔎 Interactive Search & Filter (/): Instant fuzzy search across keys and values with automatic matched node expansion.
  • 🚰 Pipe-Friendly & CI Mode (--print): Easily pipe curl, kubectl, or docker logs into interactive viewer or non-interactive formatted trees.
  • 📦 Zero Native C++ Build Dependencies: Pure JavaScript / TypeScript running anywhere Node.js runs.

🚀 Installation

Global CLI Tool

npm install -g json-term
# or run directly with npx
npx json-term data.json
# or shorthand alias
npx jsonx data.json

In Your Project (Library)

npm install json-term

🛠️ CLI Usage & Examples

1. Interactive Tree Viewer

# View local JSON file
jsonx package.json

# Directly parse inline JSON string
jsonx '{"service": "auth-api", "port": 443, "active": true, "tags": ["prod", "v2"]}'

# View piped API response
curl -s https://api.github.com/repos/nodejs/node | jsonx

# Echo / pipe JSON string
echo '{"status": 200, "data": [1, 2, 3]}' | jsonx

2. Structural JSON Diffing

# Compare two JSON configuration files
jsonx diff config.old.json config.new.json

# Diff two direct inline JSON strings
jsonx diff '{"port": 8080, "debug": true}' '{"port": 8443, "debug": true, "ssl": true}'

# Diff file against piped stdin
curl -s https://api.com/v2/config | jsonx diff config.v1.json

# Hide unchanged lines in diff
jsonx diff a.json b.json --no-unchanged

3. Simple Colorized JSON View (jq-style with Bold Keys)

# Print syntax-highlighted standard JSON format from file
jsonx --raw data.json

# Print syntax-highlighted direct JSON string
jsonx --raw '{"user": "alice", "roles": ["admin", "developer"]}'

# Piped stream
curl -s https://api.github.com/users/octocat | jsonx --raw

4. Non-Interactive Pretty Tree Print (for scripts & CI)

# Print formatted tree to stdout
jsonx --print data.json

# Pretty print inline JSON string
jsonx --print '{"name": "test", "count": 42}'

# Set initial collapse depth (e.g. depth 2)
jsonx data.json --depth 2 --print

⌨️ Interactive TUI Keybindings

| Key | Action | | :--- | :--- | | ↑ / k | Move cursor up | | ↓ / j | Move cursor down | | Enter / Space / → | Toggle expand / collapse node | | e | Expand all nodes | | c | Collapse all nodes | | p | Copy current node's JSONPath to clipboard (e.g. $.users[0].id) | | y / v | Copy current node's JSON value to clipboard | | / | Interactive search / filter | | Esc | Clear search query | | q / Ctrl+C | Exit viewer |


📖 Programmatic API (TypeScript & JavaScript)

import { 
  buildTree, 
  prettyPrintTree, 
  diffJSON, 
  prettyPrintDiff, 
  calculateDiffStats,
  InteractiveViewer 
} from "json-term";

const data = {
  service: "Gateway",
  port: 8080,
  endpoints: ["/auth", "/users", "/metrics"],
  active: true,
};

// 1. Syntax-Highlighted Standard JSON String
const colored = colorizeJSON(data);
console.log(colored);

// 2. Pretty Print Formatted Tree String
const tree = buildTree(data, "myService", "$", 0, 2);
console.log(prettyPrintTree(tree));

// 3. Compute Structural Diff
const oldConfig = { port: 8080, debug: true };
const newConfig = { port: 8443, debug: true, ssl: true };

const diffTree = diffJSON(oldConfig, newConfig, "configDiff");
const stats = calculateDiffStats(diffTree);
console.log(`Changes: +${stats.added} -${stats.removed} ~${stats.modified}`);
console.log(prettyPrintDiff(diffTree));

// 4. Launch Interactive TUI Programmatically
const viewer = new InteractiveViewer(tree);
await viewer.start();

⚙️ CLI Options Reference

| Option | Shorthand | Default | Description | | :--- | :--- | :--- | :--- | | --raw | -r | false | Print standard syntax-highlighted JSON (bold keys & typed colors) | | --format <type> | -F | "tree" | Output format (tree or json) | | --print | -p | false | Non-interactive formatted print to stdout | | --depth <number> | -d | 2 | Initial tree expansion depth | | --search <query> | -s | "" | Initial filter query for keys/values | | --no-unchanged | | false | Hide unchanged nodes in diff output | | --version | -v | | Output version | | --help | -h | | Display help menu |


🧪 Development & Testing

git clone https://github.com/authoritydmc/json-term.git
cd json-term
npm install
npm test
npm run build

🚀 Automated Release & Versioning

1-Click from GitHub Actions

Go to Actions -> Automated Version & Release -> Select patch, minor, or major -> Click Run workflow.

From Terminal

npm run release:patch
npm run release:minor
npm run release:major

📄 License

MIT © 2026 authoritydmc