Settings

Theme

Show HN: JQ-Synth – Generate jq filters from input/output examples

github.com

1 points by nulone 9 days ago · 1 comment

Reader

nuloneOP 9 days ago

I can never remember jq syntax.

Whenever I need to transform JSON, I spend 20 minutes guessing filters until something works.

So I built a CLI tool: give it input JSON and desired output, it generates the jq filter.

Example:

  Input:
  [{"name": "Alice", "email": "alice@example.com"},
   {"name": "Bob"},
   {"name": "Charlie", "email": "charlie@example.com"}]

  Wanted:
  ["alice@example.com", "charlie@example.com"]

  Generated:
  [.[] | select(.email != null) | .email]
How it works:

1. Takes your input/output examples

2. Generates a filter, runs jq, verifies the output matches

3. If wrong, retries automatically

Works with local models (Ollama) or cloud (OpenAI/Anthropic).

~450 tests, MIT licensed.

Curious what edge cases break it.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection