# jq jq-1.5 — jq 1.5 - Product: jq (https://whatsnew.fyi/product/jq) - Vendor: jq - Date: 2015-08-16 - Version: jq-1.5 - Original notes: https://github.com/jqlang/jq/releases/tag/jq-1.5 - Permalink: https://whatsnew.fyi/product/jq/releases/jq-1.5 What's New is an index, not a publisher: every entry below links to the vendor's own release notes, which are the authoritative source. Entries are labelled where they are hand-curated sample data, pre-releases, or drawn from a secondary source such as a developer blog. Reuse: release facts (products, versions, dates, links, CVE ids and flags) are open data under CC BY 4.0, from the API at https://whatsnew.fyi/api/v1 or the nightly dataset at https://github.com/whatsnew-fyi/dataset. The summaries, labels and curation are © What's New: quote freely with attribution and a link back; wholesale republication of them is not permitted — terms: https://whatsnew.fyi/terms. The vendors' own release notes remain their publishers'. --- Changes to check: - **Deprecated:** `--argfile` → `--slurpfile` (inferred by a model) - **added** — Regexp support using Oniguruma - **added** — Module system with import and include directives for namespace management - **added** — Destructuring syntax for pattern matching in variable assignments - **added** — Math functions - **added** — Online streaming parser - **added** — Minimal I/O builtins including inputs and debug - **added** — Try/catch error handling - **added** — Lexical non-local exit system with label and break - **added** — Tail call optimization for efficient recursion - **added** — Control structure builtins including while, repeat, and until - **added** — Enhanced reduce with foreach for iterative operations - **added** — Ability to read module data files in JSON format - **added** — --argjson flag to pass JSON arguments - **added** — --slurpfile flag to read JSON from files - **added** — Support for application/json-seq RFC7464 - **added** — Utility functions including bsearch for binary searching arrays - **added** — Datetime functions - **changed** — def($a): syntax now allowed as equivalent to def(a): a as $a | - **deprecated** — --argfile form replaced by --slurpfile but remains for backward compatibility - **changed** — Performance enhancements Thanks to the 20+ developers who have sent us PRs since 1.4, and the many contributors to issues and the wiki. The manual for jq 1.5 can be found at https://stedolan.github.io/jq/manual/v1.5/ Salient new features since 1.4: - regexp support (using Oniguruma)! - a proper module system `import "foo/bar" as bar; # import foo/bar.jq's defs into a bar::* namespace` and `include "foo/bar"; # import foo/bar.jq's defs into the top-level` - destructuring syntax (`. as [$first, $second, {$foo, $bar}] | ...`) - math functions - an online streaming parser - minimal I/O builtions (`inputs`, `debug`) One can now write: `jq -n 'reduce inputs as $i ( ... )'` to reduce inputs in an online way without having to slurp them first! This works with streaming too. - try/catch, for catching and handling errors (this makes for a dynamic non-local exit system) - a lexical non-local exit system One can now say `label $foo | ..... | break $foo` where the break causes control to return to the label $foo, which then produces `empty` (backtracks). There's named and anonymous labels. - tail call optimization (TCO), which allows efficient recursion in jq - a variety of new control structure builtins (e.g., `while(cond; exp)`, `repeat(exp)`, `until(cond; next)`), many of which internally use TCO - an enhanced form of `reduce`: `foreach exp as $name (init_exp; update_exp; extract_exp)` - the ability to read module data files `import "foo/bar" as $bar; # read foo/bar.json, bind to $bar::bar` - `--argjson var ''` Using --arg var bit me too many times :) - `--slurpfile var "filename"` Replaces the `--argfile` form (which is now deprecated but remains for backward compatibility). - support for application/json-seq (RFC7464) - a large variety of new utility functions, many being community contributions (e.g., `bsearch`, for binary searching arrays) - datetime functions - a variety of performance enhancements - `def($a): ...;` is now allowed as an equivalent of `def(a): a as $a | ...;` - test and build improvements, including gcov support Lastly, don't forget the wiki! The wiki has a lot of new content since 1.4, much of it contributed by the community.