No description
Find a file
heming 9a744c9242
Some checks failed
CI / test (1.24) (push) Failing after 20s
CI / lint (push) Failing after 1m20s
CI / security (push) Failing after 14s
CI / makefile-targets (push) Has been skipped
Docker Build / docker-build (push) Successful in 3s
Add clipboard paste functionality and fix bottom status bar jumping
- 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
2025-06-16 03:02:59 +02:00
.forgejo Disable staticcheck in CI lint job 2025-06-16 00:50:47 +02:00
cmd/jdig Fix major linting issues and add streaming auto-detection 2025-06-16 00:22:23 +02:00
internal Add clipboard paste functionality and fix bottom status bar jumping 2025-06-16 03:02:59 +02:00
.dockerignore Complete project restructuring and modernization 2025-06-15 23:35:21 +02:00
.gitattributes Complete project restructuring and modernization 2025-06-15 23:35:21 +02:00
.gitignore Complete project restructuring and modernization 2025-06-15 23:35:21 +02:00
.goreleaser.yml Complete project restructuring and modernization 2025-06-15 23:35:21 +02:00
Dockerfile Update repository URLs and fix CI pipeline issues 2025-06-16 00:07:08 +02:00
go.mod Update repository URLs and fix CI pipeline issues 2025-06-16 00:07:08 +02:00
go.sum Complete project restructuring and modernization 2025-06-15 23:35:21 +02:00
Makefile Update repository URLs and fix CI pipeline issues 2025-06-16 00:07:08 +02:00
quick_test.sh Implement hierarchical navigation and fix JSON parsing issues 2025-06-15 21:47:45 +02:00
README.md Add async streaming support for piped input with comprehensive testing 2025-06-15 19:10:33 +02:00
test_interactive.sh Implement hierarchical navigation and fix JSON parsing issues 2025-06-15 21:47:45 +02:00
test_suite.sh Implement hierarchical navigation and fix JSON parsing issues 2025-06-15 21:47:45 +02:00

jdig

Interactive JSON query tool using jq-compatible syntax.

Features

  • jq-compatible queries: Use the same query syntax as the popular jq tool
  • 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:

  1. Single JSON object:

    {"name": "John", "age": 30}
    
  2. 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}'