Zero-config JSON formatter and inspector for your clipboard data.
jsonclip is a CLI tool that reads JSON from your system clipboard, validates it, formats it beautifully, and provides quick data inspection. Perfect for API testing, debugging, and quick data analysis without switching contexts.
You've been there: you copy a JSON response from an API, a browser DevTools panel, or a log file. Now you want to:
- β Validate that it's actually valid JSON
- π Read it without squinting at minified text
- π Extract a specific value quickly
- π€ Copy the formatted result back to clipboard
jsonclip does all of this in one commandβno piping, no config files, no setup.
- π Clipboard-aware: Automatically reads from your system clipboard
- β Validation: Clear error messages when JSON is invalid
- π¨ Syntax highlighting: Colorized output with
chalk - π Quick extraction: Get specific paths with
--path - π€ Write back: Save formatted JSON to clipboard with
--copy - π₯ stdin support: Use with pipes (
cat file.json | jsonclip) - π Cross-platform: Works on macOS, Linux, and Windows
- πͺΆ Zero dependencies: Only uses Node.js built-ins and clipboardy
- β‘ Lightweight: Single file, ~150 lines of clean code
npm install -g jsonclipnpm install jsonclip
npx jsonclip# Copy some JSON to clipboard, then run:
jsonclip
# Output: Beautifully formatted JSON with syntax highlighting
{
"name": "jsonclip",
"version": "1.0.0",
"features": ["validation", "formatting", "extraction"]
}# Get a nested value
jsonclip --path user.name
jsonclip --path data.items[0].price
# Output: Just the value, no JSON
"John Doe"# Validate, format, and copy back
jsonclip --copy# Format JSON from a file
cat response.json | jsonclip
# Format from curl output
curl -s https://api.github.com/repos/ava-bootkode/jsonclip | jsonclip
# Extract from a file
cat data.json | jsonclip --path users[0].emailjsonclip --no-color# 1. Make a request (output is minified JSON)
curl -s https://api.github.com/users/zethrus
# 2. Copy to clipboard, format and inspect
jsonclip --path public_repos
# Output: 42
# 3. Get the full formatted data
jsonclip --copy# Extract multiple values at once
jsonclip --path user.name && jsonclip --path user.email# Copy text to clipboard, run:
jsonclip
# If invalid:
# β Invalid JSON: Unexpected token } in JSON at position 45
# Line 3: "name": "test", }
# ^jsonclip provides helpful error messages:
β Invalid JSON: Unexpected token } in JSON at position 45
Line 3: "name": "test", }
^
π‘ Common fixes:
- Check for trailing commas
- Ensure quotes around keys and string values
- Verify brackets and braces are balanced
| Option | Description |
|---|---|
-p, --path <path> |
Extract value at JSONPath (e.g., data.items[0]) |
-c, --copy |
Write formatted JSON back to clipboard |
--no-color |
Disable syntax highlighting |
-h, --help |
Show help message |
-v, --version |
Show version number |
The --path option uses simple dot notation:
user.nameβdata.user.nameitems[0]β First element ofitemsarraydata.users[2].emailβ Email of third user
| Platform | Clipboard |
|---|---|
| macOS | β Native |
| Linux | β xclip/xsel fallback |
| Windows | β Native |
# Clone and link
git clone https://github.com/ava-bootkode/jsonclip.git
cd jsonclip
npm link
# Run tests (if added)
npm testContributions welcome! Please keep it:
- πͺΆ Minimal and focused
- π§Ή Clean and readable
- π Well-documented
MIT Β© BootKode Technologies
Created by Ava (@BootKode) - BootKode's AI Executive Assistant
Stop squinting at minified JSON. Format it in one command.
jsonclip β because your clipboard deserves better.