Skip to content

Releases: duriantaco/jonq

v0.3.4 - query repair hardening

Choose a tag to compare

@duriantaco duriantaco released this 30 Apr 01:08
78f3ff0

What's Changed

  • Fixed query repair false positives for dotted string literals like 'Foo.Bar'
  • Validated sparse arrays using fields across sampled objects instead of only the first object
  • Improved nested leaf and alias repair suggestions
  • Quoted special-character keys in Smart Inspect suggestions and repair Try: commands
  • Added repair validation for from query row contexts and selected expressions

Verification

  • Full test suite passed on Python 3.9, 3.10, and 3.11 in CI
  • Local package build and twine checks passed

v0.3.3 - query repair suggestions

Choose a tag to compare

@duriantaco duriantaco released this 30 Apr 00:47
24a2df0

What's Changed

  • Added query repair suggestions for unknown fields in selected fields, filters, sorting, grouping, and aggregations
  • Error output now includes nearby field matches and a copy-paste Try: command
  • Improved nested field discovery for repair suggestions

Verification

  • Full test suite passed on Python 3.9, 3.10, and 3.11 in CI
  • Local package build and twine checks passed

v0.3.2 - Smart Inspect mode

Choose a tag to compare

@duriantaco duriantaco released this 30 Apr 00:35
02a41ad

What's Changed

  • Smart Inspect: running jonq data.json now shows root shape, readable field types, sample values, and suggested queries without adding new CLI flags
  • Suggested queries are generated from actual JSON fields for table output, raw scalar output, boolean filters, and group-by counts
  • Improved inspect behavior for deeply nested JSON and mixed arrays

Verification

  • Full test suite passed on Python 3.9, 3.10, and 3.11 in CI
  • Local package build and twine checks passed

v0.3.1 - raw scalar output

Choose a tag to compare

@duriantaco duriantaco released this 29 Apr 13:33
6d2e6c3

What's Changed

  • Added raw scalar output for shell pipelines: jonq users.json "select name" -r
  • Single-field selections now print plain values one per line in raw mode
  • Multi-field selections remain compact JSON objects per line for scriptable output
  • Updated README, usage docs, API docs, completions, and changelog

Verification

  • Full test suite passed on Python 3.9, 3.10, and 3.11 in CI
  • Local package build and twine checks passed

v0.3.0 - CASE/WHEN, table output, COALESCE, follow mode, and 20+ new functions

Choose a tag to compare

@duriantaco duriantaco released this 22 Mar 07:48

Added

Output & Display

  • Table output: --format table or -t renders results as aligned terminal tables with headers and separators
  • YAML output: --format yaml renders results as YAML (uses pyyaml if available, built-in fallback otherwise)
  • --explain mode: shows parsed query breakdown (fields, conditions, grouping) and the generated jq filter
  • --time flag: prints parse/execute/format timing to stderr
  • Auto-detect stdin: curl ... | jonq "select name" works without needing - as source

Query Language

  • CASE/WHEN/THEN/ELSE/END: conditional expressions — select case when age > 30 then "senior" else "junior" end as level
  • COALESCE: null fallback with nested function support — select coalesce(nickname, name) as display
  • || operator: SQL-standard string concatenation — select first || ' ' || last as full_name
  • IS NULL / IS NOT NULL: null checks in conditions — select * if email is not null
  • Type casting: int(), float(), str() / string(), type()
  • Date/time functions: todate(), fromdate(), date(), timestamp() with null-safe execution
  • Utility functions: keys(), values(), trim(), ltrim(), rtrim(), tojson(), fromjson(), reverse(), sort(), unique(), flatten(), not_null(), to_entries(), from_entries()

Terminal UX

  • Rich REPL: readline with persistent history (~/.jonq_history) and tab completion for field names + keywords
  • --follow mode: stream NDJSON from stdin line-by-line — tail -f app.log | jonq --follow "select level, msg if level = 'error'"
  • Shell completions: jonq --completions bash|zsh|fish generates completion scripts

Changed

  • Version bump to 0.3.0
  • Unified all function-name-to-jq-builtin mappings into a single _FUNC_MAP constant (eliminated 3 duplicate copies)
  • Expression-only queries now properly map over array elements instead of wrapping the whole input
  • Path-explorer schema preview now shows nested JSON paths like orders[].price instead of only shallow field listings
  • Reuse bounded sync and async jq worker pools for repeated identical filters
  • Main streaming execution path now chunks root-array JSON in memory instead of splitting to temp files
  • Repositioned README/package metadata around JSON exploration and extraction

Fixed

  • Null-sensitive functions (todate, tonumber) are now guarded against null input instead of crashing
  • Schema validator recognizes CASE expressions, || operator, and coalesce — no longer rejects them as unknown fields
  • Sync jq runtime errors that only write to stderr no longer hang waiting on stdout
  • Async jq workers are cleaned up with their event loop, preventing leftover subprocess transport warnings
  • --follow mode skips empty results instead of printing [] for non-matching lines

v0.2.0

Choose a tag to compare

@duriantaco duriantaco released this 08 Mar 08:24

[v0.2.0] - 2026-03-08

Added

  • DISTINCT: select distinct city returns unique rows
  • COUNT DISTINCT: select count(distinct city) as n
  • Standalone LIMIT: select * limit 10 (independent of sort)
  • IN operator: select * if city in ('New York', 'Chicago')
  • NOT operator: select * if not age > 30
  • LIKE operator: select * if name like 'Al%' (supports % wildcard for startswith, endswith, contains)
  • String functions: upper(), lower(), length()
  • Math functions: round(), abs(), ceil(), floor()
  • Schema preview: run jonq data.json with no query to inspect fields and types
  • Interactive REPL: jonq -i data.json for interactive querying
  • Watch mode: --watch flag to re-run query on file change
  • URL fetch: jonq https://api.example.com/data "select id"
  • Multi-file glob: jonq 'logs/*.json' "select *"
  • Auto-detect NDJSON: no flag needed for newline-delimited JSON
  • Fuzzy field suggestions: typo correction with Levenshtein distance
  • Colorized output: syntax-highlighted JSON when outputting to terminal
  • python -m jonq: added __main__.py entry point
  • Constants module: centralized all magic numbers and ANSI codes

Fixed

  • Dynamic HAVING field mappings instead of hardcoded alias dict
  • Removed inline jq comments (# sum) from generated filters
  • from clause now correctly iterates arrays (.path[] instead of .path)
  • Schema validator recognizes sort, distinct, as, arithmetic operators
  • Schema validator skips validation when from clause is used
  • Logging level changed from INFO to WARNING (no more filter spam)

Changed

  • Version bump to 0.2.0
  • Replaced all star imports with explicit imports
  • Replaced all hardcoded ANSI codes with _Colors class
  • Replaced all magic numbers with named constants
  • Removed dead code: handle_error, extract_value_from_quotes, _AGG_FUNCTIONS, parse_condition (jq_filter.py), use_fast parameter
  • Executor raises ValueError instead of RuntimeError for jq errors
  • Updated all Sphinx docs, README, and SYNTAX.md