No description
- Add Ctrl+V clipboard paste support in query edit mode - Handle paste status messages in Update function - Fix bottom status bar jumping by ensuring consistent panel heights - Result panel now uses fixed height to match navigation panel behavior |
||
|---|---|---|
| .forgejo | ||
| cmd/jdig | ||
| internal | ||
| .dockerignore | ||
| .gitattributes | ||
| .gitignore | ||
| .goreleaser.yml | ||
| Dockerfile | ||
| go.mod | ||
| go.sum | ||
| Makefile | ||
| quick_test.sh | ||
| README.md | ||
| test_interactive.sh | ||
| test_suite.sh | ||
jdig
Interactive JSON query tool using jq-compatible syntax.
Features
- jq-compatible queries: Use the same query syntax as the popular
jqtool - Multiple input formats: Handle both single JSON objects and arrays of objects (one per line)
- File and stdin support: Read from files or pipe data through stdin
- Real-time updates: Watch files for changes and update results automatically
- Interactive mode: Query JSON data interactively with a REPL-like interface
- Streaming mode: Process large datasets asynchronously with real-time updates
- Non-blocking processing: User can always cancel operations, input never blocks display
Installation
go build -o jdig
Usage
Basic Usage
# Query from stdin
echo '{"name": "John", "age": 30}' | ./jdig '.name'
# Query from file
./jdig -f data.json '.[] | select(.age > 25)'
# Default query (.) shows all data
./jdig -f data.json
Interactive Mode
./jdig -i -f data.json
This opens an interactive prompt where you can enter jq queries:
jdig interactive mode - Enter jq queries (Ctrl+C to exit)
Loaded 3 JSON object(s)
jdig> .[] | .name
"John"
"Jane"
"Bob"
jdig> .[] | select(.age > 30)
{
"age": 35,
"name": "Bob"
}
jdig> exit
Watch Mode
./jdig -w -f data.json '.[] | .name'
This watches the file for changes and automatically updates the output when the file is modified.
Streaming Mode
For large datasets or continuous data streams:
# Stream processing with real-time updates
cat large_dataset.json | ./jdig --stream '.[] | select(.status == "error")'
# Interactive streaming (updates results as new data arrives)
tail -f log.json | ./jdig -i --stream '.[] | .request.method'
Streaming mode processes JSON data asynchronously and updates results in real-time. The user can always cancel operations and input processing never blocks the display.
Flags
-f, --file: Input JSON file (default: stdin)-i, --interactive: Interactive mode-w, --watch: Watch file for changes-s, --stream: Enable streaming mode for large datasets-h, --help: Show help
Input Formats
jdig supports two JSON input formats:
-
Single JSON object:
{"name": "John", "age": 30} -
Multiple JSON objects (one per line):
{"name": "John", "age": 30} {"name": "Jane", "age": 25} {"name": "Bob", "age": 35}
When multiple objects are provided, they are automatically wrapped in an array for querying.
Examples
# Get all names
./jdig -f users.json '.[].name'
# Filter by age
./jdig -f users.json '.[] | select(.age >= 30)'
# Get the first user
./jdig -f users.json '.[0]'
# Count users
./jdig -f users.json 'length'
# Interactive querying
./jdig -i -f users.json
# Watch file for changes
./jdig -w -f users.json '.[] | {name, age}'