claude-plugins/plugins/json-pretty/commands/format.md
Cal Corum f963a8f388 refactor: convert json-pretty format skill to a command
Move from skills/ to commands/ so it shows as /json-pretty:format
in the autocomplete menu with the plugin name prefix. Move the
script to scripts/ to match command-based plugin conventions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 14:22:56 -05:00

1.4 KiB

description allowed-tools
Format, validate, or minify JSON without external online services Bash

When to Use

Use when the user asks to:

  • "prettify json"
  • "format json"
  • "pretty print json"
  • "validate json"
  • "clean up json"
  • Or mentions wanting to format/prettify JSON data

Tool Location

${CLAUDE_PLUGIN_ROOT}/scripts/json-pretty.py

Also symlinked to ~/.local/bin/json-pretty for PATH access.

Usage

# From file
json-pretty input.json

# From stdin/pipe
cat data.json | json-pretty
echo '{"foo":"bar"}' | json-pretty

# Save to file
json-pretty input.json -o output.json

# Options
json-pretty input.json --indent 4      # Custom indentation
json-pretty input.json --sort-keys     # Sort object keys
json-pretty input.json --compact       # Minify instead of prettify

Options

  • -o, --output FILE: Write to file instead of stdout
  • -i, --indent N: Indentation spaces (default: 2)
  • -s, --sort-keys: Sort object keys alphabetically
  • -c, --compact: Compact output (minify)

Examples

Prettify inline JSON:

echo '{"name":"cal","items":[1,2,3]}' | json-pretty

Format a file:

json-pretty messy.json -o clean.json

Sort keys and use 4-space indent:

json-pretty data.json --indent 4 --sort-keys

Privacy Note

Built specifically to avoid posting potentially sensitive JSON to online prettifier services.