Skip to content

Repository files navigation

Griddy

A CLI tool to render JSON data as tables.

Binary name: grdy

Installation

Homebrew (macOS)

brew install chrismo/grdy/grdy

Shell installer

curl -fsSL https://raw.githubusercontent.com/chrismo/grdy/main/install.sh | bash

This installs to ~/.local/bin. Make sure it's in your PATH:

export PATH="$HOME/.local/bin:$PATH"

To install a specific version:

curl -fsSL https://raw.githubusercontent.com/chrismo/grdy/main/install.sh | bash -s v0.7.0

Usage

# From stdin
echo '[{"name": "Alice", "age": 30}, {"name": "Bob", "age": 25}]' | grdy

# From file
grdy data.json

Example output:

╭───────┬─────╮
│ name  │ age │
├───────┼─────┤
│ Alice │ 30  │
│ Bob   │ 25  │
╰───────┴─────╯

With --ascii:

+-------+-----+
| name  | age |
+-------+-----+
| Alice | 30  |
| Bob   | 25  |
+-------+-----+

With --plain:

name   age
Alice   30
Bob     25

Handles sparse keys, nested structures, and mixed types:

echo '[
  {"name": "Alice", "role": "admin", "active": true, "tags": ["go", "rust"]},
  {"name": "Bob", "role": "user", "active": false, "meta": {"level": 5}},
  {"name": "Charlie", "active": true, "score": 92.5}
]' | grdy
╭─────────┬───────┬────────┬───────────┬──────────┬───────╮
│ name    │ role  │ active │ tags      │ meta     │ score │
├─────────┼───────┼────────┼───────────┼──────────┼───────┤
│ Alice   │ admin │ true   │ [2 items] │          │       │
│ Bob     │ user  │ false  │           │ {1 keys} │       │
│ Charlie │       │ true   │           │          │ 92.5  │
╰─────────┴───────┴────────┴───────────┴──────────┴───────╯

Options

  • -a, --ascii - Use ASCII instead of Unicode box-drawing
  • -s, --stripe - Dim alternate rows for readability
  • -p, --plain - Aligned columns only, no borders or lines
  • -H, --no-header - Hide the header row

Input formats

  • JSON array of objects
  • Single JSON object
  • JSONL (newline-delimited JSON)

Nested arrays display as [N items] and nested objects as {N keys}.

Configuration

Create ~/.config/grdy/config.json (or $XDG_CONFIG_HOME/grdy/config.json) to set defaults:

{
  "ascii": false,
  "stripe": false,
  "plain": false,
  "no_header": false
}

CLI flags override config file settings.

License

BSD 3-Clause

About

Griddy - JSON as a Table

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages