NEWS.md
This file
Path
NEWS.md
768 lines · 29.6 KiB · Markdown
Last changed by
Update NEWS.md and AUTHORS for 1.8.2 (#3529)itchynybefore adoption88e8340
History of this fileTake it
1# 1.8.223This is a patch release with security fixes and bug fixes since 1.8.1, along with new builds for Windows arm64 and Docker arm/v7.4Full commit log can be found at <https://github.com/jqlang/jq/compare/jq-1.8.1...jq-1.8.2>.56## Security fixes78- CVE-2026-32316: Fix heap buffer overflow in `jvp_string_append` and `jvp_string_copy_replace_bad`.9 @itchyny e47e56d226519635768e6aab2f38f0ab037c09e510- CVE-2026-33947: Limit path depth to prevent stack overflow in `jv_setpath`, `jv_getpath`, `jv_delpaths`.11 @itchyny fb59f1491058d58bdc3e8dd28f1773d1ac690a1f12- CVE-2026-33948: Fix NUL truncation in the JSON parser.13 @itchyny 6374ae0bcdfe33a18eb0ae6db28493b1f34a0a5b14- CVE-2026-39956: Fix `_strindices` missing runtime type checks.15 @tlsbollei fdf8ef0f0810e3d365cdd5160de43db46f57ed0316- CVE-2026-39979: Fix out-of-bounds read in `jv_parse_sized()`.17 @wader 2f09060afab23fe9390cce7cb860b10416e1bf5f18- CVE-2026-40164: Randomize hash seed to mitigate hash collision DoS attacks.19 @AsafMeizner @itchyny 0c7d133c3c7e37c00b6d46b658a02244fdd3c78420- CVE-2026-40612: Limit containment check depth to prevent stack overflow in `contains`.21 @itchyny d1a12569d91641135976a8536776a4a329c02cc222- CVE-2026-41256: Fix NUL truncation in program files loaded with `-f`.23 @itchyny 5a015deae35d19e3ebbc65db6c157a80e76df73824- CVE-2026-41257: Fix signed-int overflow in `stack_reallocate`.25 @itchyny 01b3cded76daacbfddb7f8763700b0803bcb5c6f26- CVE-2026-43894: Reject numeric literals longer than `DEC_MAX_DIGITS` (999999999).27 @itchyny 9761ceb7d6cc48c16b25f0ab1baaef0e701927e428- CVE-2026-43895: Reject embedded NUL bytes in module import paths.29 @itchyny 9d223f153c3632a207fa071caaa6292da33ae36130- CVE-2026-43896: Limit recursive object merge depth to prevent stack overflow.31 @itchyny 532ccea6080ed6758f39fe9f6208a44b665023d232- CVE-2026-44777: Detect circular module imports to prevent stack overflow.33 @itchyny f58787c41835d9b17795730cb04925fdba25c71c34- CVE-2026-47770: Guard deep structural equality and comparison recursion.35 @fuyu0425 7122866869960b55cea3646bc91334ef5578783136- CVE-2026-49839: Fix heap-buffer-overflow in raw file loading.37 @itchyny e987df0d463d85fd70825e042a082427e8275b8638- CVE-2026-54679: Tighten string length bounds and propagate invalid jv in implode.39 @itchyny 46d1da30944ce93dd671ac72b6513fc0eb74783740- GHSA-gf4g-95wj-4q4r: Fix use-after-free in `args2obj()` array argument path. @sseal #349841- GHSA-hj52-j2c9-r8r4: Fix signed-int overflow in `tokenadd` to prevent buffer overflow.42 @itchyny 63751f8a9f94dc6d3370084ad0d60826c58b955d43- Limit the number of function parameters and definitions to prevent SEGV. @OwenSanzas #346044- Pre-allocate `tokenbuf` for string parser to avoid undefined behavior. @fab1ano #348545- Avoid stack overflow when freeing deeply nested values.46 @itchyny 33d7bce3218ec718139342e5b48b475c4dea715f47- Fix memory leaks and double frees. @itchyny #34874849## Releasing5051- Add builds for Windows arm64. @dennisameling #337652- Support arm/v7 architecture in Docker images. @itchyny #346353- Update GPG signing key. @itchyny 0ff997f7c4c07660ffc6ad2506d5f56b8136208b54- Add `artifact-metadata` permission for actions/attest. @itchyny #353055- Upload attestation bundle as a release artifact, allowing unauthenticated56 verification via `gh attestation verify --bundle jq-attestation.json`.57 @itchyny #35635859## CLI changes6061- Improve error message truncation with closing delimiters. @itchyny #347862- Remove extra space from `die` function output. @krtk6160 #339163- Fix raw input flag not to corrupt multi-byte characters. @itchyny #342164- Fix crash when importing a module with errors twice. @itchyny #349765- Increase the maximum printing depth from 256 to 10000. @ishnagy #34146667## Changes to existing functions6869- Fix `rtrimstr("")` always outputting `""`. @A4-Tacks #341570- Fix infinite loop and undefined behavior in `del(.[nan])`. @itchyny #349071- Refactor `@uri` and `@urid` to fix multi-byte UTF-8 corruption. @itchyny #349572- Fix `tonumber` and `toboolean` to reject strings with embedded null bytes. @itchyny #349673- Fix undefined behavior in modulo operator. @fab1ano #348674- Fix reversed pointer subtraction in `f_env` bounds check. @itchyny #346575- Fix missing validity check in `f_strflocaltime` after `f_localtime`. @itchyny #349176- Fix year 2038 problem on 32-bit platforms. @itchyny #340777- Use `//` instead of `//=` in `from_entries` definition. @itchyny #35167879## Build and test changes8081- Drop `strptime` test using non-portable `%F`. @alyssais #336582- Limit oniguruma depth to 1024 in `jq_fuzz_execute`. @sudhackar #337783- Fix localization test for time formatting functions. @itchyny #340984- Fix expected value assertion. @itchyny #3431 #340885- Fix typo in tests/jq.test. @bigmoonbit #344186- Refactor `tm2jv` to handle fractional seconds. @itchyny #348987- Fix `jq_fuzz_parse_stream`: use iterative parser API for streaming mode. @OwenSanzas #349988- Fix crashes and resource leaks in `jq_testsuite`. @itchyny #350989- Support building with `--disable-maintainer-mode` and source != build dir. @Saur2000 #351890- Add Solaris support. @vlmarek #351591- Respect `SOURCE_DATE_EPOCH` while generating man page. @McSinyx #351492- Fix undefined pointer arithmetic in UTF-8 helpers. @theyoucheng df924eae91af10cc236a907cdadd97813827aa1f93- Fix one-byte over-read in `BASE64_DECODE_TABLE`. @itchyny #35479495## Documentation changes9697- Add wiki link to navigation bar. @wader #342498- Add missing word in manual for rawfile. @jpmens #343499- Fix typo "stder" to "stderr". @jjatria #3446100- Fix buttons in tutorial to toggle labels when clicked on. @itchyny #3493101- Fix "happened" spelling in tutorial changelog entries. @Rohan5commit #3525102103# 1.8.1104105This is a patch release to fix security, performance, and build issues found in 1.8.0.106Full commit log can be found at <https://github.com/jqlang/jq/compare/jq-1.8.0...jq-1.8.1>.107108## Security fixes109110- CVE-2025-49014: Fix heap use after free in `f_strftime`, `f_strflocaltime`.111 @wader 499c91bca9d4d027833bc62787d1bb075c03680e112- GHSA-f946-j5j2-4w5m: Fix stack overflow in `node_min_byte_len` of oniguruma.113 @wader 5e159b34b179417e3e0404108190a2ac7d65611c114115## CLI changes116117- Fix assertion failure when syntax error happens at the end of the query. @itchyny #3350118119## Changes to existing functions120121- Fix portability of `strptime/1` especially for Windows. @itchyny #3342122123## Language changes124125- Revert the change of `reduce`/`foreach` state variable in 1.8.0 (#3205).126 This change was reverted due to serious performance regression. @itchyny #3349127128## Documentation changes129130- Add LICENSE notice of NetBSD's `strptime()` to COPYING. @itchyny #3344131132## Build improvements133134- Fix build on old Mac with old sed. @qianbinbin #3336135136# 1.8.0137138We are pleased to announce the release of version 1.8.0.139This release includes a number of improvements since the last version.140Note that some changes may introduce breaking changes to existing scripts,141so be sure to read the following information carefully.142Full commit log can be found at <https://github.com/jqlang/jq/compare/jq-1.7.1...jq-1.8.0>.143144## Releasing145146- Change the version number pattern to `1.X.Y` (`1.8.0` instead of `1.8`). @itchyny #2999147- Generate provenance attestations for release artifacts and docker image. @lectrical #3225148149 ```sh150 gh attestation verify --repo jqlang/jq jq-linux-amd64151 gh attestation verify --repo jqlang/jq oci://ghcr.io/jqlang/jq:1.8.0152 ```153154## Security fixes155156- CVE-2024-23337: Fix signed integer overflow in `jvp_array_write` and `jvp_object_rehash`.157 @itchyny de21386681c0df0104a99d9d09db23a9b2a78b1e158 - The fix for this issue now limits the maximum size of arrays and objects to 536870912 (`2^29`) elements.159- CVE-2024-53427: Reject NaN with payload while parsing JSON.160 @itchyny a09a4dfd55e6c24d04b35062ccfe4509748b1dd3161 - The fix for this issue now drops support for NaN with payload in JSON (like `NaN123`).162 Other JSON extensions like `NaN` and `Infinity` are still supported.163- CVE-2025-48060: Fix heap buffer overflow in `jv_string_vfmt`.164 @itchyny c6e041699d8cd31b97375a2596217aff2cfca85b165- Fix use of uninitialized value in `check_literal`. @itchyny #3324166- Fix segmentation fault on `strftime/1`, `strflocaltime/1`. @itchyny #3271167- Fix unhandled overflow in `@base64d`. @emanuele6 #3080168169## CLI changes170171- Fix `--indent 0` implicitly enabling `--compact-output`. @amarshall @gbrlmarn @itchyny #3232172173 ```sh174 $ jq --indent 0 . <<< '{ "foo": ["hello", "world"] }'175 {176 "foo": [177 "hello",178 "world"179 ]180 }181 # Previously, this implied --compact-output, but now outputs with new lines.182 ```183184- Improve error messages to show problematic position in the filter. @itchyny #3292185186 ```sh187 $ jq -n '1 + $foo + 2'188 jq: error: $foo is not defined at <top-level>, line 1, column 5:189 1 + $foo + 2190 ^^^^191 jq: 1 compile error192 ```193194- Include column number in parser and compiler error messages. @liviubobocu #3257195- Fix error message for string literal beginning with single quote. @mattmeyers #2964196197 ```sh198 $ jq .foo <<< "{'foo':'bar'}"199 jq: parse error: Invalid string literal; expected ", but got ' at line 1, column 7200 # Previously, the error message was Invalid numeric literal at line 1, column 7.201 ```202203- Improve `JQ_COLORS` environment variable to support larger escapes like truecolor. @SArpnt #3282204205 ```sh206 JQ_COLORS="38;2;255;173;173:38;2;255;214;165:38;2;253;255;182:38;2;202;255;191:38;2;155;246;255:38;2;160;196;255:38;2;189;178;255:38;2;255;198;255" jq -nc '[null,false,true,42,{"a":"bc"}]'207 ```208209- Add `--library-path` long option for `-L`. @thaliaarchi #3194210- Fix `--slurp --stream` when input has no trailing newline character. @itchyny #3279211- Fix `--indent` option to error for malformed values. @thaliaarchi #3195212- Fix option parsing of `--binary` on non-Windows platforms. @calestyo #3131213- Fix issue with `~/.jq` on Windows where `$HOME` is not set. @kirkoman #3114214- Fix broken non-Latin output in the command help on Windows. @itchyny #3299215- Increase the maximum parsing depth for JSON to 10000. @itchyny #3328216- Parse short options in order given. @thaliaarchi #3194217- Consistently reset color formatting. @thaliaarchi #3034218219## New functions220221- Add `trim/0`, `ltrim/0` and `rtrim/0` to trim leading and trailing white spaces. @wader #3056222223 ```sh224 $ jq -n '" hello " | trim, ltrim, rtrim'225 "hello"226 "hello "227 " hello"228 ```229230- Add `trimstr/1` to trim string from both ends. @gbrlmarn #3319231232 ```sh233 $ jq -n '"foobarfoo" | trimstr("foo")'234 "bar"235 ```236237- Add `add/1`. Generator variant of `add/0`. @myaaaaaaaaa #3144238239 ```sh240 $ jq -c '.sum = add(.xs[])' <<< '{"xs":[1,2,3]}'241 {"xs":[1,2,3],"sum":6}242 ```243244- Add `skip/2` as the counterpart to `limit/2`. @itchyny #3181245246 ```sh247 $ jq -nc '[1,2,3,4,5] | [skip(2; .[])]'248 [3,4,5]249 ```250251- Add `toboolean/0` to convert strings to booleans. @brahmlower @itchyny #2098252253 ```sh254 $ jq -n '"true", "false" | toboolean'255 true256 false257 ```258259- Add `@urid` format. Reverse of `@uri`. @fmgornick #3161260261 ```sh262 $ jq -Rr '@urid' <<< '%6a%71'263 jq264 ```265266## Changes to existing functions267268- Use code point index for `indices/1`, `index/1` and `rindex/1`. @wader #3065269 - This is a breaking change. Use `utf8bytelength/0` to get byte index.270- Improve `tonumber/0` performance and rejects numbers with leading or trailing271 white spaces. @itchyny @thaliaarchi #3055 #3195272 - This is a breaking change. Use `trim/0` to remove leading and trailing white spaces.273- Populate timezone data when formatting time. This fixes timezone name in274 `strftime/1`, `strflocaltime/1` for DST. @marcin-serwin @sihde #3203 #3264 #3323275- Preserve numerical precision on unary negation, `abs/0`, `length/0`. @itchyny #3242 #3275276- Make `last(empty)` yield no output values like `first(empty)`. @itchyny #3179277- Make `ltrimstr/1` and `rtrimstr/1` error for non-string inputs. @emanuele6 #2969278- Make `limit/2` error for negative count. @itchyny #3181279- Fix `mktime/0` overflow and allow fewer elements in date-time representation array. @emanuele6 #3070 #3162280- Fix non-matched optional capture group. @wader #3238281- Provide `strptime/1` on all systems. @george-hopkins @fdellwing #3008 #3094282- Fix `_WIN32` port of `strptime`. @emanuele6 #3071283- Improve `bsearch/1` performance by implementing in C. @eloycoto #2945284- Improve `unique/0` and `unique_by/1` performance. @itchyny @emanuele6 #3254 #3304285- Fix error messages including long string literal not to break Unicode characters. @itchyny #3249286- Remove `pow10/0` as it has been deprecated in glibc 2.27. Use `exp10/0` instead. @itchyny #3059287- Remove private (and undocumented) `_nwise` filter. @itchyny #3260288289## Language changes290291- Fix precedence of binding syntax against unary and binary operators.292 Also, allow some expressions as object values. @itchyny #3053 #3326293 - This is a breaking change that may change the output of filters with binding syntax as follows.294295 ```sh296 $ jq -nc '[-1 as $x | 1,$x]'297 [1,-1] # previously, [-1,-1]298 $ jq -nc '1 | . + 2 as $x | -$x'299 -3 # previously, -1300 $ jq -nc '{x: 1 + 2, y: false or true, z: null // 3}'301 {"x":3,"y":true,"z":3} # previously, syntax error302 ```303304- Support Tcl-style multiline comments. @emanuele6 #2989305306 ```sh307 #!/bin/sh --308 # Can be use to do shebang scripts.309 # Next line will be seen as a comment be of the trailing backslash. \310 exec jq ...311 # this jq expression will result in [1]312 [313 1,314 # \315 2316 ]317 ```318319- Fix `foreach` not to break init backtracking with `DUPN`. @kanwren #3266320321 ```sh322 $ jq -n '[1, 2] | foreach .[] as $x (0, 1; . + $x)'323 1324 3325 2326 4327 ```328329- Fix `reduce`/`foreach` state variable should not be reset each iteration. @itchyny #3205330331 ```sh332 $ jq -n 'reduce range(5) as $x (0; .+$x | select($x!=2))'333 8334 $ jq -nc '[foreach range(5) as $x (0; .+$x | select($x!=2); [$x,.])]'335 [[0,0],[1,1],[3,4],[4,8]]336 ```337338- Support CRLF line breaks in filters. @itchyny #3274339- Improve performance of repeating strings. @itchyny #3272340341## Documentation changes342343- Switch the homepage to custom domain [jqlang.org](https://jqlang.org). @itchyny @owenthereal #3243344- Make latest release instead of development version the default manual. @wader #3130345- Add opengraph meta tags. @wader #3247346- Replace jqplay.org with play.jqlang.org @owenthereal #3265347- Add missing line from decNumber's licence to `COPYING`. @emanuele6 #3106348- Various document improvements. @tsibley #3322, @itchyny #3240, @jhcarl0814 #3239,349 @01mf02 #3184, @thaliaarchi #3199, @NathanBaulch #3173, @cjlarose #3164,350 @sheepster1 #3105, #3103, @kishoreinvits #3042, @jbrains #3035, @thalman #3033,351 @SOF3 #3017, @wader #3015, @wllm-rbnt #3002352353## Build improvements354355- Fix build with GCC 15 (C23). @emanuele6 #3209356- Fix build with `-Woverlength-strings` @emanuele6 #3019357- Fix compiler warning `type-limits` in `found_string`. @itchyny #3263358- Fix compiler error in `jv_dtoa.c` and `builtin.c`. @UlrichEckhardt #3036359- Fix warning: a function definition without a prototype is deprecated. @itchyny #3259360- Define `_BSD_SOURCE` in `builtin.c` for OpenBSD support. @itchyny #3278361- Define empty `JV_{,V}PRINTF_LIKE` macros if `__GNUC__` is not defined. @emanuele6 #3160362- Avoid `ctype.h` abuse: cast `char` to `unsigned char` first. @riastradh #3152363- Remove multiple calls to free when successively calling `jq_reset`. @Sameesunkaria #3134364- Enable IBM z/OS support. @sachintu47 #3277365- Fix insecure `RUNPATH`. @orbea #3212366- Avoid zero-length `calloc`. @itchyny #3280367- Move oniguruma and decNumber to vendor directory. @itchyny #3234368369## Test improvements370371- Run tests in C locale. @emanuele6 #3039372- Improve reliability of `NO_COLOR` tests. @dag-erling #3188373- Improve `shtest` not to fail if `JQ_COLORS` and `NO_COLOR` are already set. @SArpnt #3283374- Refactor constant folding tests. @itchyny #3233375- Make tests pass when `--disable-decnum`. @nicowilliams 6d02d53f515bf1314d644eee93ba30b0d11c7d2b376- Disable Valgrind by default during testing. @itchyny #3269377378# 1.7.1379380## Security381382- CVE-2023-50246: Fix heap buffer overflow in jvp\_literal\_number\_literal383- CVE-2023-50268: fix stack-buffer-overflow if comparing nan with payload384385## CLI changes386387- Make the default background color more suitable for bright backgrounds. @mjarosie @taoky @nicowilliams @itchyny #2904388- Allow passing the inline jq script after `--`. @emanuele6 #2919389- Restrict systems operations on OpenBSD and remove unused `mkstemp`. @klemensn #2934390- Fix possible uninitialised value dereference if `jq_init()` fails. @emanuele6 @nicowilliams #2935391392## Language changes393394- Simplify `paths/0` and `paths/1`. @asheiduk @emanuele6 #2946395- Reject `U+001F` in string literals. @torsten-schenk @itchyny @wader #2911396- Remove unused nref accumulator in `block_bind_library`. @emanuele6 #2914397- Remove a bunch of unused variables, and useless assignments. @emanuele6 #2914398- main.c: Remove unused EXIT\_STATUS\_EXACT option. @emanuele6 #2915399- Actually use the number correctly casted from double to int as index. @emanuele6 #2916400- src/builtin.c: remove unnecessary jv\_copy-s in type\_error/type\_error2. @emanuele6 #2937401- Remove undefined behavior caught by LLVM 10 UBSAN. @Gaelan @emanuele6 #2926402- Convert decnum to binary64 (double) instead of decimal64. This makes jq behave like the JSON specification suggests and more similar to other languages. @wader @leonid-s-usov #2949403- Fix memory leaks on invalid input for `ltrimstr/1` and `rtrimstr/1`. @emanuele6 #2977404- Fix memory leak on failed get for `setpath/2`. @emanuele6 #2970405- Fix nan from json parsing also for nans with payload that start with 'n'. @emanuele6 #2985406- Allow carriage return characters in comments. @emanuele6 #2942 #2984407408## Documentation changes409410- Generate links in the man page. @emanuele6 #2931411- Standardize arch types to AMD64 & ARM64 from index page download dropdown. @owenthereal #2884412413## libjq414415- Add extern C for C++. @rockwotj #2953416417## Build and test changes418419- Fix incorrect syntax for checksum file. @kamontat @wader #2899420- Remove `-dirty` version suffix for windows release build. @itchyny #2888421- Make use of `od` in tests more compatible. @nabijaczleweli @emanuele6 @nicowilliams #2922422- Add dependabot. @yeikel #2889423- Extend fuzzing setup to fuzz parser and JSON serializer. @DavidKorczynski @emanuele6 #2952424- Keep releasing executables with legacy names. @itchyny #2951425426# 1.7427428After a five year hiatus we're back with a GitHub organization, with new admins and new maintainers who have brought a great deal of energy to make a long-awaited and long-needed new release. We're very grateful for all the new owners, admins, and maintainers. Special thanks go to Owen Ou (@owenthereal) for pushing to set up a new GitHub organization for jq, Stephen Dolan (@stedolan) for transferring the jq repository to the new organization, @itchyny for doing a great deal of work to get the release done, Mattias Wadman (@wader) and Emanuele Torre (@emanuele6) for many PRs and code reviews. Many others also contributed PRs, issues, and code reviews as well, and you can find their contributions in the Git log and on the [closed issues and PRs page](https://github.com/jqlang/jq/issues?q=is%3Aclosed+sort%3Aupdated-desc).429430Since the last stable release many things have happened:431432- jq now lives at <https://github.com/jqlang>433- New maintainers, admins, and owners have been recruited.434 - A list of [current maintainers](https://github.com/jqlang/jq/blob/jq-1.7/AUTHORS#L4-L14)435- NEWS file is replaced by NEWS.md with Markdown format. @wader #2599436- CI, scan builds, release, website builds etc now use GitHub actions. @owenthereal @wader @itchyny #2596 #2603 #2620 #2723437- Lots of documentation improvements and fixes.438- Website updated with new section search box, better section ids for linking, dark mode, etc. @itchyny #2628439- Release builds for:440 - Linux `amd64`, `arm64`, `armel`, `armhf`, `i386`, `mips`, `mips64`, `mips64el`, `mips64r6`, `mips64r6el`, `mipsel`, `mipsr6`, `mipsr6el`, `powerpc`, `ppc64el`, `riscv64` and `s390x`441 - macOS `amd64` and `arm64`442 - Windows `i386` and `amd64`443 - Docker `linux/386`, `linux/amd64`, `linux/arm64`, `linux/mips64le`, `linux/ppc64le`, `linux/riscv64` and `linux/s390x`444 - More details see @owenthereal #2665445- Docker images are now available from `ghcr.io/jqlang/jq` instead of Docker Hub. @itchyny #2652 #2686446- OSS-fuzz. @DavidKorczynski #2760 #2762447448Full commit log can be found at <https://github.com/jqlang/jq/compare/jq-1.6...jq-1.7> but here are some highlights:449450## CLI changes451452- Make object key color configurable using `JQ_COLORS` environment variable. @itchyny @haguenau @ericpruitt #2703453454 ```sh455 # this would make "field" bold yellow (`1;33`, the last value)456 $ JQ_COLORS="0;90:0;37:0;37:0;37:0;32:1;37:1;37:1;33" ./jq -n '{field: 123}'457 {458 "field": 123459 }460 ```461462- Change the default color of null to Bright Black. @itchyny #2824463- Respect `NO_COLOR` environment variable to disable color output. See <https://no-color.org> for details. @itchyny #2728464- Improved `--help` output. Now mentions all options and nicer order. @itchyny @wader #2747 #2766 #2799465- Fix multiple issues of exit code using `--exit-code`/`-e` option. @ryo1kato #1697466467 ```sh468 # true-ish last output value exits with zero469 $ jq -ne true ; echo $?470 true471 0472 # false-ish last output value (false and null) exits with 1473 $ jq -ne false ; echo $?474 false475 1476 # no output value exists with 4477 $ jq -ne empty ; echo $?478 4479 ```480481- Add `--binary`/`-b` on Windows for binary output. To get `\n` instead of `\r\n` line endings. @nicowilliams 0dab2b1482- Add `--raw-output0` for NUL (zero byte) separated output. @asottile @pabs3 @itchyny #1990 #2235 #2684483484 ```sh485 # will output a zero byte after each output486 $ jq -n --raw-output0 '1,2,3' | xxd487 00000000: 3100 3200 3300 1.2.3.488 # can be used with xargs -0489 $ jq -n --raw-output0 '"a","b","c"' | xargs -0 -n1490 a491 b492 c493 $ jq -n --raw-output0 '"a b c", "d\ne\nf"' | xargs -0 printf '[%s]\n'494 [a b c]495 [d496 e497 f]498 # can be used with read -d ''499 $ while IFS= read -r -d '' json; do500 > jq '.name' <<< "$json"501 > done < <(jq -n --raw-output0 '{name:"a b c"},{name:"d\ne\nf"}')502 "a b c"503 "d\ne\nf"504 # also it's an error to output a string containing a NUL when using NUL separator505 $ jq -n --raw-output0 '"\u0000"'506 jq: error (at <unknown>): Cannot dump a string containing NUL with --raw-output0 option507 ```508509- Fix assert crash and validate JSON for `--jsonarg`. @wader #2658510- Remove deprecated `--argfile` option. @itchyny #2768511- Enable stack protection. @nicowilliams #2801512513## Language changes514515- Use decimal number literals to preserve precision. Comparison operations respects precision but arithmetic operations might truncate. @leonid-s-usov #1752516517 ```sh518 # precision is preserved519 $ echo '100000000000000000' | jq .520 100000000000000000521 # comparison respects precision (this is false in JavaScript)522 $ jq -n '100000000000000000 < 100000000000000001'523 true524 # sort/0 works525 $ jq -n -c '[100000000000000001, 100000000000000003, 100000000000000004, 100000000000000002] | sort'526 [100000000000000001,100000000000000002,100000000000000003,100000000000000004]527 # arithmetic operations might truncate (same as JavaScript)528 $ jq -n '100000000000000000 + 10'529 100000000000000020530 ```531532- Adds new builtin `pick(stream)` to emit a projection of the input object or array. @pkoppstein #2656 #2779533534 ```sh535 $ jq -n '{"a": 1, "b": {"c": 2, "d": 3}, "e": 4} | pick(.a, .b.c, .x)'536 {537 "a": 1,538 "b": {539 "c": 2540 },541 "x": null542 }543 ```544545- Adds new builtin `debug(msgs)` that works like `debug` but applies a filter on the input before writing to stderr. @pkoppstein #2710546547 ```sh548 $ jq -n '1 as $x | 2 | debug("Entering function foo with $x == \($x)", .) | (.+1)'549 ["DEBUG:","Entering function foo with $x == 1"]550 ["DEBUG:",2]551 3552 $ jq -n '{a: 1, b: 2, c: 3} | debug({a, b, sum: (.a+.b)})'553 ["DEBUG:",{"a":1,"b":2,"sum":3}]554 {555 "a": 1,556 "b": 2,557 "c": 3558 }559 ```560561- Adds new builtin `scan($re; $flags)`. Was documented but not implemented. @itchyny #1961562563 ```sh564 # look for pattern "ab" in "abAB" ignoring casing565 $ jq -n '"abAB" | scan("ab"; "i")'566 "ab"567 "AB"568 ```569570- Adds new builtin `abs` to get absolute value. This potentially allows the literal value of numbers to be preserved as `length` and `fabs` convert to float. @pkoppstein #2767571- Allow `if` without `else`-branch. When skipped the `else`-branch will be `.` (identity). @chancez @wader #1825 #2481572573 ```sh574 # convert 1 to "one" otherwise keep as is575 $ jq -n '1,2 | if . == 1 then "one" end'576 "one"577 2578 # behaves the same as579 $ jq -n '1,2 | if . == 1 then "one" else . end'580 "one"581 2582 # also works with elif583 $ jq -n '1,2,3 | if . == 1 then "one" elif . == 2 then "two" end584 "one"585 "two"586 3587 ```588589- Allow use of `$binding` as key in object literals. @nicowilliams 8ea4a55590591 ```sh592 $ jq -n '"a" as $key | {$key: 123}'593 {594 "a": 123595 }596 # previously parentheses were needed597 $ jq -n '"a" as $key | {($key): 123}'598 {599 "a": 123600 }601 ```602603- Allow dot between chained indexes when using `.["index"]` @nicowilliams #1168604605 ```sh606 $ jq -n '{"a": {"b": 123}} | .a["b"]'607 123608 # now this also works609 $ jq -n '{"a": {"b": 123}} | .a.["b"]'610 123611 ```612613- Allow dot for chained value iterator `.[]`, `.[]?` @wader #2650614615 ```sh616 $ jq -n '{"a": [123]} | .a[]'617 123618 # now this also works619 $ jq -n '{"a": [123]} | .a.[]'620 123621 ```622623- Fix try/catch catches more than it should. @nicowilliams #2750624- Speed up and refactor some builtins, also remove `scalars_or_empty/0`. @muhmuhten #1845625- Now `halt` and `halt_error` exit immediately instead of continuing to the next input. @emanuele6 #2667626- Fix issue converting string to number after previous convert error. @thalman #2400627- Fix issue representing large numbers on some platforms causing invalid JSON output. @itchyny #2661628- Fix deletion using assigning empty against arrays. @itchyny #2133629630 ```sh631 # now this works as expected, filter out all values over 2 by assigning empty632 $ jq -c '(.[] | select(. >= 2)) |= empty' <<< '[1,5,3,0,7]'633 [1,0]634 ```635636- Allow keywords to be used as binding name in more places. @emanuele6 #2681637- Allow using `nan` as NaN in JSON. @emanuele6 #2712638- Expose a module's function names in `modulemeta`. @mrwilson #2837639- Fix `contains/1` to handle strings with NUL. @nicowilliams 61cd6db640- Fix `stderr/0` to output raw text without any decoration. @itchyny #2751641- Fix `nth/2` to emit empty on index out of range. @itchyny #2674642- Fix `implode` to not assert and instead replace invalid Unicode codepoints. @wader #2646643- Fix `indices/1` and `rindex/1` in case of overlapping matches in strings. @emanuele6 #2718644- Fix `sub/3` to resolve issues involving global search-and-replace (gsub) operations. @pkoppstein #2641645- Fix `significand/0`, `gamma/0` and `drem/2` to be available on macOS. @itchyny #2756 #2775646- Fix empty regular expression matches. @itchyny #2677647- Fix overflow exception of the modulo operator. @itchyny #2629648- Fix string multiplication by 0 (and less than 1) to emit empty string. @itchyny #2142649- Fix segfault when using libjq and threads. @thalman #2546650- Fix constant folding of division and reminder with zero divisor. @itchyny #2797651- Fix `error/0`, `error/1` to throw null error. @emanuele6 #2823652- Simpler and faster `transpose`. @pkoppstein #2758653- Simple and efficient implementation of `walk/1`. @pkoppstein #2795654- Remove deprecated filters `leaf_paths`, `recurse_down`. @itchyny #2666655656# Previous releases657658Release history659660- jq version 1.6 was released on Fri Nov 2 2018661- jq version 1.5 was released on Sat Aug 15 2015662- jq version 1.4 was released on Mon Jun 9 2014663- jq version 1.3 was released on Sun May 19 2013664- jq version 1.2 was released on Thu Dec 20 2012665- jq version 1.1 was released on Sun Oct 21 2012666- jq version 1.0 was released on Sun Oct 21 2012667668New features in 1.6 since 1.5:669670- Destructuring Alternation671672- New Builtins:673 - builtins/0674 - stderr/0675 - halt/0, halt_error/1676 - isempty/1677 - walk/1678 - utf8bytelength/1679 - localtime/0, strflocaltime/1680 - SQL-style builtins681 - and more!682683- Add support for ASAN and UBSAN684685- Make it easier to use jq with shebangs (8f6f28c)686687- Add $ENV builtin variable to access environment688689- Add JQ_COLORS env var for configuring the output colors690691New features in 1.5 since 1.4:692693- regular expressions (with Oniguruma)694695- a library/module system696697- many new builtins698699 - datetime builtins700 - math builtins701 - regexp-related builtins702 - stream-related builtins (e.g., all/1, any/1)703 - minimal I/O builtins (`inputs`, `debug`)704705- new syntactic features, including:706707 - destructuring (`. as [$first, $second] | ...`)708 - try/catch, generalized `?` operator, and label/break709 - `foreach`710 - multiple definitions of a function with different numbers of711 arguments712713- command-line arguments714715 - --join-lines / -j for raw output716 - --argjson and --slurpfile717 - --tab and --indent718 - --stream (streaming JSON parser)719 - --seq (RFC7464 JSON text sequence)720 - --run-tests improvements721722- optimizations:723724 - tail-call optimization725 - reduce and foreach no longer leak a reference to .726727New features in 1.4 since 1.3:728729- command-line arguments730731 - jq --arg-file variable file732 - jq --unbuffered733 - jq -e / --exit-status (set exit status based on outputs)734 - jq -S / --sort-keys (now jq no longer sorts object keys by735 default736737- syntax738739 - .. -> like // in XPath (recursive traversal)740 - question mark (e.g., .a?) to suppress errors741 - ."foo" syntax (equivalent to .["foo"])742 - better error handling for .foo743 - added % operator (modulo)744 - allow negation without requiring extra parenthesis745 - more function arguments (up to six)746747- filters:748749 - any, all750 - iterables, arrays, objects, scalars, nulls, booleans, numbers,751 strings, values752753- string built-ins:754755 - split756 - join (join an array of strings with a given separator string)757 - ltrimstr, rtrimstr758 - startswith, endswith759 - explode, implode760 - fromjson, tojson761 - index, rindex, indices762763- math functions764765 - floor, sqrt, cbrt, etcetera (depends on what's available from libm)766767- libjq -- a C API interface to jq's JSON representation and for768 running jq programs from C applications