Skip to content
chrismoPublic

About

Griddy - JSON as a Table

Resources

Stars

1 star

Watchers

0 watching

Forks

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.8.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 key} │       │
│ 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)

Arrays must contain only objects. Nested arrays display as [N items] and nested objects as {N keys} (singular for 1). Numeric columns are right-aligned. Control characters in strings (newlines, tabs) are shown escaped (\n, \t).

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 are combined with config file settings: a flag can turn an option on, but can't turn off one the config enables.

License

BSD 3-Clause

About

Griddy - JSON as a Table

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages