summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2023-09-07 18:01:22 +0000
committergithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2023-09-07 18:01:22 +0000
commitc268e3ab1c041c6ab2ed9673bc7777d10de33f50 (patch)
treedabfbd8d0dbc5ae7cb14cf7b372c93459b61130c
parentfdbf3ce0c718e0347439221279b8cb709f46e810 (diff)
Update website
-rw-r--r--.gitignore1
-rw-r--r--download/index.html75
-rw-r--r--index.html17
-rw-r--r--manual/index.html2
-rw-r--r--manual/v1.7/index.html8310
5 files changed, 8374 insertions, 31 deletions
diff --git a/.gitignore b/.gitignore
index 7fa0f655..d1ffac38 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,6 +18,7 @@ jq.1
# Generated source
src/builtin.inc
+src/config_opts.inc
*.pc
# Autotools junk
diff --git a/download/index.html b/download/index.html
index 357ccb1d..0335e920 100644
--- a/download/index.html
+++ b/download/index.html
@@ -87,28 +87,36 @@ http://download.icu-project.org/files/decNumber/decNumber-icu-368.zip.</p>
Install using <code>sudo pacman -S jq</code>.</p>
</li>
<li>
+<p>jq 1.7 binaries for
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.7/jq-linux-amd64">AMD64</a>
+ or
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.7/jq-linux-arm64">ARM64</a>
+ or
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.7/jq-linux-i386">i386</a>.</p>
+</li>
+<li>
<p>jq 1.6 binaries for
- <a href="https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux64">64-bit</a>
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux64">AMD64</a>
or
- <a href="https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux32">32-bit</a>.</p>
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux32">i386</a>.</p>
</li>
<li>
<p>jq 1.5 binaries for
- <a href="https://github.com/jqlang/jq/releases/download/jq-1.5/jq-linux64">64-bit</a>
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.5/jq-linux64">AMD64</a>
or
- <a href="https://github.com/jqlang/jq/releases/download/jq-1.5/jq-linux32">32-bit</a>.</p>
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.5/jq-linux32">i386</a>.</p>
</li>
<li>
<p>jq 1.4 binaries for
- <a href="https://github.com/jqlang/jq/releases/download/jq-1.4/jq-linux-x86_64">64-bit</a>
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.4/jq-linux-x86_64">AMD64</a>
or
- <a href="https://github.com/jqlang/jq/releases/download/jq-1.4/jq-linux-x86">32-bit</a>.</p>
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.4/jq-linux-x86">i386</a>.</p>
</li>
<li>
<p>jq 1.3 binaries for
- <a href="https://github.com/jqlang/jq/releases/download/jq-1.3/jq-linux-x86_64">64-bit</a>
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.3/jq-linux-x86_64">AMD64</a>
or
- <a href="https://github.com/jqlang/jq/releases/download/jq-1.3/jq-linux-x86">32-bit</a>.</p>
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.3/jq-linux-x86">i386</a>.</p>
</li>
</ul>
<h3>macOS</h3>
@@ -123,24 +131,30 @@ http://download.icu-project.org/files/decNumber/decNumber-icu-368.zip.</p>
<p>Use <a href="https://finkproject.org">Fink</a> to install jq with <code>fink install jq</code>.</p>
</li>
<li>
+<p>jq 1.7 binaries for
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.7/jq-macos-amd64">AMD64</a>
+ or
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.7/jq-macos-arm64">ARM64</a>.</p>
+</li>
+<li>
<p>jq 1.6 binary for
- <a href="https://github.com/jqlang/jq/releases/download/jq-1.6/jq-osx-amd64">64-bit</a>.</p>
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.6/jq-osx-amd64">AMD64</a>.</p>
</li>
<li>
<p>jq 1.5 binary for
- <a href="https://github.com/jqlang/jq/releases/download/jq-1.5/jq-osx-amd64">64-bit</a>.</p>
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.5/jq-osx-amd64">AMD64</a>.</p>
</li>
<li>
<p>jq 1.4 binaries for
- <a href="https://github.com/jqlang/jq/releases/download/jq-1.4/jq-osx-x86_64">64-bit</a>
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.4/jq-osx-x86_64">AMD64</a>
or
- <a href="https://github.com/jqlang/jq/releases/download/jq-1.4/jq-osx-x86">32-bit</a>.</p>
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.4/jq-osx-x86">i386</a>.</p>
</li>
<li>
<p>jq 1.3 binaries for
- <a href="https://github.com/jqlang/jq/releases/download/jq-1.3/jq-osx-x86_64">64-bit</a>
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.3/jq-osx-x86_64">AMD64</a>
or
- <a href="https://github.com/jqlang/jq/releases/download/jq-1.3/jq-osx-x86">32-bit</a>.</p>
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.3/jq-osx-x86">i386</a>.</p>
</li>
</ul>
<h3>FreeBSD</h3>
@@ -164,9 +178,9 @@ http://download.icu-project.org/files/decNumber/decNumber-icu-368.zip.</p>
</li>
<li>
<p>jq 1.4 binaries for Solaris 11
- <a href="https://github.com/jqlang/jq/releases/download/jq-1.4/jq-solaris11-64">64-bit</a>
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.4/jq-solaris11-64">AMD64</a>
or
- <a href="https://github.com/jqlang/jq/releases/download/jq-1.4/jq-solaris11-32">32-bit</a>.</p>
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.4/jq-solaris11-32">i386</a>.</p>
</li>
</ul>
<h3>Windows</h3>
@@ -183,34 +197,42 @@ http://download.icu-project.org/files/decNumber/decNumber-icu-368.zip.</p>
<code>chocolatey install jq</code>.</p>
</li>
<li>
+<p>jq 1.7 executables for
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.7/jq-windows-amd64.exe">AMD64</a>
+ or
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.7/jq-windows-i386.exe">i386</a>.</p>
+</li>
+<li>
<p>jq 1.6 executables for
- <a href="https://github.com/jqlang/jq/releases/download/jq-1.6/jq-win64.exe">64-bit</a>
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.6/jq-win64.exe">AMD64</a>
or
- <a href="https://github.com/jqlang/jq/releases/download/jq-1.6/jq-win32.exe">32-bit</a>.</p>
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.6/jq-win32.exe">i386</a>.</p>
</li>
<li>
<p>jq 1.5 executables for
- <a href="https://github.com/jqlang/jq/releases/download/jq-1.5/jq-win64.exe">64-bit</a>
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.5/jq-win64.exe">AMD64</a>
or
- <a href="https://github.com/jqlang/jq/releases/download/jq-1.5/jq-win32.exe">32-bit</a>.</p>
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.5/jq-win32.exe">i386</a>.</p>
</li>
<li>
<p>jq 1.4 executables for
- <a href="https://github.com/jqlang/jq/releases/download/jq-1.4/jq-win64.exe">64-bit</a>
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.4/jq-win64.exe">AMD64</a>
or
- <a href="https://github.com/jqlang/jq/releases/download/jq-1.4/jq-win32.exe">32-bit</a>.</p>
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.4/jq-win32.exe">i386</a>.</p>
</li>
<li>
<p>jq 1.3 executables for
- <a href="https://github.com/jqlang/jq/releases/download/jq-1.3/jq-win64.exe">64-bit</a>
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.3/jq-win64.exe">AMD64</a>
or
- <a href="https://github.com/jqlang/jq/releases/download/jq-1.3/jq-win32.exe">32-bit</a>.</p>
+ <a href="https://github.com/jqlang/jq/releases/download/jq-1.3/jq-win32.exe">i386</a>.</p>
</li>
</ul>
<h3>Checksums and signatures</h3>
<p>SHA-256 checksums are provided for all release and pre-release binaries.
They can be found under
<a href="https://github.com/jqlang/jq/tree/master/sig">sig/v1.x/sha256sum.txt</a>.
+The checksums for jq 1.7 are in
+<a href="https://raw.githubusercontent.com/jqlang/jq/master/sig/v1.7/sha256sum.txt">sig/v1.7/sha256sum.txt</a>.
The checksums for jq 1.6 are in
<a href="https://raw.githubusercontent.com/jqlang/jq/master/sig/v1.6/sha256sum.txt">sig/v1.6/sha256sum.txt</a>.
The checksums for jq 1.5 are in
@@ -218,8 +240,8 @@ The checksums for jq 1.5 are in
<p>Additionally, all release artifacts are signed by a jq release key. We have two release keys, <a href="https://raw.githubusercontent.com/jqlang/jq/master/sig/jq-release-old.key">one for 1.6 and older releases</a>, and <a href="https://raw.githubusercontent.com/jqlang/jq/master/sig/jq-release-new.key">one for 1.7 and newer releases</a>.
Signatures can be found under
<a href="https://github.com/jqlang/jq/tree/master/sig">sig/v1.x/*.asc</a>.
-The signatures for jq 1.7rc are in
-<a href="https://github.com/jqlang/jq/tree/master/sig/v1.7rc1">sig/v1.7rc1/*.asc</a>.
+The signatures for jq 1.7 are in
+<a href="https://github.com/jqlang/jq/tree/master/sig/v1.7">sig/v1.7/*.asc</a>.
The signatures for jq 1.6 are in
<a href="https://github.com/jqlang/jq/tree/master/sig/v1.6">sig/v1.6/*.asc</a>.
The signatures for jq 1.5 are in
@@ -228,6 +250,7 @@ You can use <a href="https://gnupg.org/">GnuPG</a> to verify a signature by down
the signature and running <code>gpg --verify signature.asc</code>.</p>
<h3>From source on Linux, macOS, Cygwin, and other POSIX-like operating systems</h3>
<ul>
+<li><a href="https://github.com/jqlang/jq/releases/download/jq-1.7/jq-1.7.tar.gz">Source tarball for jq 1.7</a></li>
<li><a href="https://github.com/jqlang/jq/releases/download/jq-1.6/jq-1.6.tar.gz">Source tarball for jq 1.6</a></li>
<li><a href="https://github.com/jqlang/jq/releases/download/jq-1.5/jq-1.5.tar.gz">Source tarball for jq 1.5</a></li>
</ul>
diff --git a/index.html b/index.html
index df4caba6..5550523f 100644
--- a/index.html
+++ b/index.html
@@ -66,13 +66,15 @@ jq is a lightweight and flexible command-line JSON processor.
</h2>
<div class="btn-group d-print-none" role="group">
<button type="button" class="btn btn-primary dropdown-toggle text-nowrap" data-bs-toggle="dropdown" aria-expanded="false">
- Download jq 1.6
+ Download jq 1.7
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
- <li><a class="dropdown-item" href="https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux64" aria-label="Link to download executable: Linux (64-bit)"><span class="bi bi-download me-2" aria-hidden="true"></span>Linux (64-bit)</a></li>
- <li><a class="dropdown-item" href="https://github.com/jqlang/jq/releases/download/jq-1.6/jq-osx-amd64" aria-label="Link to download executable: macOS (64-bit)"><span class="bi bi-download me-2" aria-hidden="true"></span>macOS (64-bit)</a></li>
- <li><a class="dropdown-item" href="https://github.com/jqlang/jq/releases/download/jq-1.6/jq-win64.exe" aria-label="Link to download executable: Windows (64-bit)"><span class="bi bi-download me-2" aria-hidden="true"></span>Windows (64-bit)</a></li>
+ <li><a class="dropdown-item" href="https://github.com/jqlang/jq/releases/download/jq-1.7/jq-linux-amd64" aria-label="Link to download executable: Linux (AMD 64-bit)"><span class="bi bi-download me-2" aria-hidden="true"></span>Linux (AMD 64-bit)</a></li>
+ <li><a class="dropdown-item" href="https://github.com/jqlang/jq/releases/download/jq-1.7/jq-linux-arm64" aria-label="Link to download executable: Linux (ARM 64-bit)"><span class="bi bi-download me-2" aria-hidden="true"></span>Linux (ARM 64-bit)</a></li>
+ <li><a class="dropdown-item" href="https://github.com/jqlang/jq/releases/download/jq-1.7/jq-macos-amd64" aria-label="Link to download executable: macOS (AMD 64-bit)"><span class="bi bi-download me-2" aria-hidden="true"></span>macOS (AMD 64-bit)</a></li>
+ <li><a class="dropdown-item" href="https://github.com/jqlang/jq/releases/download/jq-1.7/jq-macos-arm64" aria-label="Link to download executable: macOS (ARM 64-bit)"><span class="bi bi-download me-2" aria-hidden="true"></span>macOS (ARM 64-bit)</a></li>
+ <li><a class="dropdown-item" href="https://github.com/jqlang/jq/releases/download/jq-1.7/jq-windows-amd64.exe" aria-label="Link to download executable: Windows (64-bit)"><span class="bi bi-download me-2" aria-hidden="true"></span>Windows (64-bit)</a></li>
<li><a class="dropdown-item" href="/jq/download/">Other platforms, older versions, and source</a></li>
</ul>
<a class="btn btn-primary text-nowrap" href="https://jqplay.org" target="_blank" rel="noopener">
@@ -105,6 +107,13 @@ on <a href="https://libera.chat/">Libera.Chat</a>. For more interactive discussi
<h2>News</h2>
<ul>
<li>
+ <span class="fst-italic">7 September 2023</span>
+ <p>After a five-year hiatus, we've returned with a revitalized <a href="https://github.com/jqlang">GitHub organization</a>
+and a much-anticipated 1.7 release, thanks to our new admins and maintainers.
+Check out the <a href="./download/">download</a> page for installation options and see the
+<a href="https://github.com/jqlang/jq/releases/tag/jq-1.7">release notes</a> for details.</p>
+ </li>
+ <li>
<span class="fst-italic">1 November 2018</span>
<p>jq 1.6 released. See installation options on the <a href="./download/">download</a>
page, and the <a href="https://github.com/jqlang/jq/releases/tag/jq-1.6">release notes</a>
diff --git a/manual/index.html b/manual/index.html
index cea28535..baa3db27 100644
--- a/manual/index.html
+++ b/manual/index.html
@@ -117,7 +117,7 @@
</nav>
<main id="main" class="col-md-9" data-bs-spy="scroll" data-bs-target="#contents" data-bs-threshold="0,1" data-bs-root-margin="-30% 0% -70%">
<h1>jq Manual (development version)</h1>
- <p><em>For released versions, see <a href="./v1.6/">jq 1.6</a>, <a href="./v1.5/">jq 1.5</a>,
+ <p><em>For released versions, see <a href="./v1.7/">jq 1.7</a>, <a href="./v1.6/">jq 1.6</a>, <a href="./v1.5/">jq 1.5</a>,
<a href="./v1.4/">jq 1.4</a> or <a href="./v1.3/">jq 1.3</a>.</em></p>
<p>A jq program is a "filter": it takes an input, and produces an
output. There are a lot of builtin filters for extracting a
diff --git a/manual/v1.7/index.html b/manual/v1.7/index.html
new file mode 100644
index 00000000..03268f49
--- /dev/null
+++ b/manual/v1.7/index.html
@@ -0,0 +1,8310 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <title>jq 1.7 Manual</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <link rel="icon" href="/jq/icon.svg" type="image/svg+xml">
+ <link rel="apple-touch-icon" href="/jq/icon.png" type="image/png">
+ <link rel="canonical" href="https://jqlang.github.io/jq/manual/v1.7/">
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootswatch@5.3.1/dist/cosmo/bootstrap.min.css"
+ integrity="sha384-dulfW0vmzZ638jigSgZXvDxMmd70GCnIv6oa+riKq6Kk4E0MKf7qmBfwP02wltv5" crossorigin="anonymous">
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css"
+ integrity="sha384-Ay26V7L8bsJTsX9Sxclnvsn+hkdiwRnrjZJXqKmkIDobPgIIWBOVguEcQQLDuhfN" crossorigin="anonymous">
+ <link rel="stylesheet" href="/jq/css/style.css" type="text/css">
+ <script>
+ (function() {
+ function setTheme(mediaQuery) {
+ document.documentElement.setAttribute('data-bs-theme',
+ document.documentElement.style.colorScheme = mediaQuery.matches ? 'dark' : 'light');
+ }
+ const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
+ setTheme(mediaQuery); mediaQuery.addEventListener('change', setTheme);
+ })();
+ </script>
+ </head>
+
+ <body>
+ <div class="container visually-hidden-focusable">
+ <a class="d-inline-flex p-2" href="#main">Skip to main content</a>
+ <a class="d-inline-flex p-2 m-1" href="#contents">Skip to table of contents</a>
+ </div>
+ <header class="navbar navbar-expand-md sticky-top bg-body-tertiary d-print-none">
+ <nav class="container-lg" aria-label="Page navigation">
+ <button type="button" class="navbar-toggler" data-bs-toggle="offcanvas" data-bs-target="#navbar-collapse"
+ aria-controls="navbar-collapse" aria-expanded="false" aria-label="Toggle page navigation">
+ <span class="navbar-toggler-icon"></span>
+ </button>
+ <a class="navbar-brand" href="/jq/" aria-label="Top page"><img src="/jq/jq.svg" alt="jq logo" style="height:1.5rem"></a>
+ <div id="navbar-collapse" class="offcanvas offcanvas-start navbar-collapse w-auto" aria-labelledby="navbar-title">
+ <div class="offcanvas-header">
+ <h3 id="navbar-title" class="me-3">jq</h3>
+ <button type="button" class="d-md-none btn-close" data-bs-dismiss="offcanvas" aria-label="Close page navigation"></button>
+ </div>
+ <ul class="offcanvas-body navbar-nav me-auto text-nowrap">
+ <li class="nav-item d-md-none"><a class="nav-link" href="/jq/">Top page</a></li>
+ <li class="nav-item"><a class="nav-link" href="/jq/tutorial/">Tutorial</a></li>
+ <li class="nav-item"><a class="nav-link" href="/jq/download/">Download</a></li>
+ <li class="nav-item"><a class="nav-link" href="/jq/manual/">Manual</a></li>
+ <li class="nav-item"><a class="nav-link" href="https://github.com/jqlang/jq" target="_blank" rel="noopener">GitHub</a></li>
+ <li class="nav-item"><a class="nav-link" href="https://github.com/jqlang/jq/issues" target="_blank" rel="noopener">Issues</a></li>
+ <li class="nav-item"><a class="nav-link" href="https://jqplay.org" target="_blank" rel="noopener">Try online!</a></li>
+ <li class="nav-item"><a class="nav-link" href="https://raw.githubusercontent.com/jqlang/jq/master/NEWS.md" target="_blank" rel="noopener">News</a></li>
+ </ul>
+ </div>
+ <div class="container-searchbox form-control p-0 d-none d-md-flex d-print-none border" style="width:16rem">
+ <span class="bi bi-search my-auto ms-2 me-1" aria-hidden="true"></span>
+ <input type="text" id="searchbox" class="form-control border-0 px-1" placeholder="Search manual" role="combobox"
+ aria-label="Search manual" aria-keyshortcuts="/" aria-expanded="false" autocomplete="off" spellcheck="false">
+ <kbd class="mx-1 my-auto text-body bg-body rounded border" style="padding:.1rem .2rem" aria-hidden="true">/</kbd>
+ </div>
+ <a class="d-md-none bi bi-github fs-4 text-body" href="https://github.com/jqlang/jq" target="_blank" rel="noopener" aria-label="GitHub"></a>
+ </nav>
+ </header>
+
+ <div class="container-lg row align-items-start mx-auto p-3">
+
+ <button type="button" class="d-md-none w-auto position-fixed bottom-0 end-0 p-2 m-3 bg-body-secondary border-0 text-body d-print-none"
+ data-bs-toggle="offcanvas" data-bs-target="#contents" aria-controls="contents" aria-expanded="false" aria-label="Toggle table of contents">
+ <span class="bi bi-list" aria-hidden="true"></span>
+ </button>
+ <nav id="contents" class="col-md-3 sticky-md-top p-3 overflow-y-auto offcanvas-md offcanvas-end d-print-none" style="top:4.5rem; height:calc(100dvh - 5.5rem);" aria-label="Table of contents">
+ <div class="d-flex justify-content-between">
+ <h4>Contents</h4>
+ <button type="button" class="btn-close d-md-none" data-bs-dismiss="offcanvas" data-bs-target="#contents" aria-label="Close table of contents"></button>
+ </div>
+ <ul class="offcanvas-md-body nav nav-pills flex-column">
+ <li class="nav-item" data-bs-dismiss="offcanvas" data-bs-target="#contents">
+ <a class="nav-link" href="#invoking-jq">Invoking jq</a>
+ </li>
+ <li class="nav-item" data-bs-dismiss="offcanvas" data-bs-target="#contents">
+ <a class="nav-link" href="#basic-filters">Basic filters</a>
+ </li>
+ <li class="nav-item" data-bs-dismiss="offcanvas" data-bs-target="#contents">
+ <a class="nav-link" href="#types-and-values">Types and Values</a>
+ </li>
+ <li class="nav-item" data-bs-dismiss="offcanvas" data-bs-target="#contents">
+ <a class="nav-link" href="#builtin-operators-and-functions">Builtin operators and functions</a>
+ </li>
+ <li class="nav-item" data-bs-dismiss="offcanvas" data-bs-target="#contents">
+ <a class="nav-link" href="#conditionals-and-comparisons">Conditionals and Comparisons</a>
+ </li>
+ <li class="nav-item" data-bs-dismiss="offcanvas" data-bs-target="#contents">
+ <a class="nav-link" href="#regular-expressions">Regular expressions</a>
+ </li>
+ <li class="nav-item" data-bs-dismiss="offcanvas" data-bs-target="#contents">
+ <a class="nav-link" href="#advanced-features">Advanced features</a>
+ </li>
+ <li class="nav-item" data-bs-dismiss="offcanvas" data-bs-target="#contents">
+ <a class="nav-link" href="#math">Math</a>
+ </li>
+ <li class="nav-item" data-bs-dismiss="offcanvas" data-bs-target="#contents">
+ <a class="nav-link" href="#io">I/O</a>
+ </li>
+ <li class="nav-item" data-bs-dismiss="offcanvas" data-bs-target="#contents">
+ <a class="nav-link" href="#streaming">Streaming</a>
+ </li>
+ <li class="nav-item" data-bs-dismiss="offcanvas" data-bs-target="#contents">
+ <a class="nav-link" href="#assignment">Assignment</a>
+ </li>
+ <li class="nav-item" data-bs-dismiss="offcanvas" data-bs-target="#contents">
+ <a class="nav-link" href="#modules">Modules</a>
+ </li>
+ <li class="nav-item" data-bs-dismiss="offcanvas" data-bs-target="#contents">
+ <a class="nav-link" href="#colors">Colors</a>
+ </li>
+ </ul>
+ </nav>
+ <main id="main" class="col-md-9" data-bs-spy="scroll" data-bs-target="#contents" data-bs-threshold="0,1" data-bs-root-margin="-30% 0% -70%">
+ <h1>jq 1.7 Manual</h1>
+ <p><em>The manual for the development version of jq can be found
+<a href="../">here</a>.</em></p>
+ <p>A jq program is a "filter": it takes an input, and produces an
+output. There are a lot of builtin filters for extracting a
+particular field of an object, or converting a number to a string,
+or various other standard tasks.</p>
+<p>Filters can be combined in various ways - you can pipe the output of
+one filter into another filter, or collect the output of a filter
+into an array.</p>
+<p>Some filters produce multiple results, for instance there's one that
+produces all the elements of its input array. Piping that filter
+into a second runs the second filter for each element of the
+array. Generally, things that would be done with loops and iteration
+in other languages are just done by gluing filters together in jq.</p>
+<p>It's important to remember that every filter has an input and an
+output. Even literals like "hello" or 42 are filters - they take an
+input but always produce the same literal as output. Operations that
+combine two filters, like addition, generally feed the same input to
+both and combine the results. So, you can implement an averaging
+filter as <code>add / length</code> - feeding the input array both to the <code>add</code>
+filter and the <code>length</code> filter and then performing the division.</p>
+<p>But that's getting ahead of ourselves. :) Let's start with something
+simpler:</p>
+ <section id="invoking-jq">
+ <h2>Invoking jq <a href="#invoking-jq" class="icon-link" aria-label="Link to this section: Invoking jq"><span class="bi bi-link-45deg" aria-hidden="true"></span></a></h2>
+ <p>jq filters run on a stream of JSON data. The input to jq is
+parsed as a sequence of whitespace-separated JSON values which
+are passed through the provided filter one at a time. The
+output(s) of the filter are written to standard output, as a
+sequence of newline-separated JSON data.</p>
+<p>The simplest and most common filter (or jq program) is <code>.</code>,
+which is the identity operator, copying the inputs of the jq
+processor to the output stream. Because the default behavior of
+the jq processor is to read JSON texts from the input stream,
+and to pretty-print outputs, the <code>.</code> program's main use is to
+validate and pretty-print the inputs. The jq programming
+language is quite rich and allows for much more than just
+validation and pretty-printing.</p>
+<p>Note: it is important to mind the shell's quoting rules. As a
+general rule it's best to always quote (with single-quote
+characters on Unix shells) the jq program, as too many characters with special
+meaning to jq are also shell meta-characters. For example, <code>jq
+"foo"</code> will fail on most Unix shells because that will be the same
+as <code>jq foo</code>, which will generally fail because <code>foo is not
+defined</code>. When using the Windows command shell (cmd.exe) it's
+best to use double quotes around your jq program when given on the
+command-line (instead of the <code>-f program-file</code> option), but then
+double-quotes in the jq program need backslash escaping. When using
+the Powershell (<code>powershell.exe</code>) or the Powershell Core
+(<code>pwsh</code>/<code>pwsh.exe</code>), use single-quote characters around the jq
+program and backslash-escaped double-quotes (<code>\"</code>) inside the jq
+program.</p>
+<ul>
+<li>Unix shells: <code>jq '.["foo"]'</code></li>
+<li>Powershell: <code>jq '.[\"foo\"]'</code></li>
+<li>Windows command shell: <code>jq ".[\"foo\"]"</code></li>
+</ul>
+<p>Note: jq allows user-defined functions, but every jq program
+must have a top-level expression.</p>
+<p>You can affect how jq reads and writes its input and output
+using some command-line options:</p>
+<ul>
+<li><code>--null-input</code> / <code>-n</code>:</li>
+</ul>
+<p>Don't read any input at all. Instead, the filter is run once
+ using <code>null</code> as the input. This is useful when using jq as a
+ simple calculator or to construct JSON data from scratch.</p>
+<ul>
+<li><code>--raw-input</code> / <code>-R</code>:</li>
+</ul>
+<p>Don't parse the input as JSON. Instead, each line of text is
+ passed to the filter as a string. If combined with <code>--slurp</code>,
+ then the entire input is passed to the filter as a single long
+ string.</p>
+<ul>
+<li><code>--slurp</code> / <code>-s</code>:</li>
+</ul>
+<p>Instead of running the filter for each JSON object in the
+ input, read the entire input stream into a large array and run
+ the filter just once.</p>
+<ul>
+<li><code>--compact-output</code> / <code>-c</code>:</li>
+</ul>
+<p>By default, jq pretty-prints JSON output. Using this option
+ will result in more compact output by instead putting each
+ JSON object on a single line.</p>
+<ul>
+<li><code>--raw-output</code> / <code>-r</code>:</li>
+</ul>
+<p>With this option, if the filter's result is a string then it
+ will be written directly to standard output rather than being
+ formatted as a JSON string with quotes. This can be useful for
+ making jq filters talk to non-JSON-based systems.</p>
+<ul>
+<li><code>--raw-output0</code>:</li>
+</ul>
+<p>Like <code>-r</code> but jq will print NUL instead of newline after each output.
+ This can be useful when the values being output can contain newlines.
+ When the output value contains NUL, jq exits with non-zero code.</p>
+<ul>
+<li><code>--join-output</code> / <code>-j</code>:</li>
+</ul>
+<p>Like <code>-r</code> but jq won't print a newline after each output.</p>
+<ul>
+<li><code>--ascii-output</code> / <code>-a</code>:</li>
+</ul>
+<p>jq usually outputs non-ASCII Unicode codepoints as UTF-8, even
+ if the input specified them as escape sequences (like
+ "\u03bc"). Using this option, you can force jq to produce pure
+ ASCII output with every non-ASCII character replaced with the
+ equivalent escape sequence.</p>
+<ul>
+<li><code>--sort-keys</code> / <code>-S</code>:</li>
+</ul>
+<p>Output the fields of each object with the keys in sorted order.</p>
+<ul>
+<li><code>--color-output</code> / <code>-C</code> and <code>--monochrome-output</code> / <code>-M</code>:</li>
+</ul>
+<p>By default, jq outputs colored JSON if writing to a
+ terminal. You can force it to produce color even if writing to
+ a pipe or a file using <code>-C</code>, and disable color with <code>-M</code>.
+ When the <code>NO_COLOR</code> environment variable is not empty, jq disables
+ colored output by default, but you can enable it by <code>-C</code>.</p>
+<p>Colors can be configured with the <code>JQ_COLORS</code> environment
+ variable (see below).</p>
+<ul>
+<li><code>--tab</code>:</li>
+</ul>
+<p>Use a tab for each indentation level instead of two spaces.</p>
+<ul>
+<li><code>--indent n</code>:</li>
+</ul>
+<p>Use the given number of spaces (no more than 7) for indentation.</p>
+<ul>
+<li><code>--unbuffered</code>:</li>
+</ul>
+<p>Flush the output after each JSON object is printed (useful if
+ you're piping a slow data source into jq and piping jq's
+ output elsewhere).</p>
+<ul>
+<li><code>--stream</code>:</li>
+</ul>
+<p>Parse the input in streaming fashion, outputting arrays of path
+ and leaf values (scalars and empty arrays or empty objects).
+ For example, <code>"a"</code> becomes <code>[[],"a"]</code>, and <code>[[],"a",["b"]]</code>
+ becomes <code>[[0],[]]</code>, <code>[[1],"a"]</code>, and <code>[[2,0],"b"]</code>.</p>
+<p>This is useful for processing very large inputs. Use this in
+ conjunction with filtering and the <code>reduce</code> and <code>foreach</code> syntax
+ to reduce large inputs incrementally.</p>
+<ul>
+<li><code>--stream-errors</code>:</li>
+</ul>
+<p>Like <code>--stream</code>, but invalid JSON inputs yield array values
+ where the first element is the error and the second is a path.
+ For example, <code>["a",n]</code> produces <code>["Invalid literal at line 1,
+ column 7",[1]]</code>.</p>
+<p>Implies <code>--stream</code>. Invalid JSON inputs produce no error values
+ when <code>--stream</code> without <code>--stream-errors</code>.</p>
+<ul>
+<li><code>--seq</code>:</li>
+</ul>
+<p>Use the <code>application/json-seq</code> MIME type scheme for separating
+ JSON texts in jq's input and output. This means that an ASCII
+ RS (record separator) character is printed before each value on
+ output and an ASCII LF (line feed) is printed after every
+ output. Input JSON texts that fail to parse are ignored (but
+ warned about), discarding all subsequent input until the next
+ RS. This mode also parses the output of jq without the <code>--seq</code>
+ option.</p>
+<ul>
+<li><code>-f filename</code> / <code>--from-file filename</code>:</li>
+</ul>
+<p>Read filter from the file rather than from a command line, like
+ awk's -f option. You can also use '#' to make comments.</p>
+<ul>
+<li><code>-L directory</code>:</li>
+</ul>
+<p>Prepend <code>directory</code> to the search list for modules. If this
+ option is used then no builtin search list is used. See the
+ section on modules below.</p>
+<ul>
+<li><code>--arg name value</code>:</li>
+</ul>
+<p>This option passes a value to the jq program as a predefined
+ variable. If you run jq with <code>--arg foo bar</code>, then <code>$foo</code> is
+ available in the program and has the value <code>"bar"</code>. Note that
+ <code>value</code> will be treated as a string, so <code>--arg foo 123</code> will
+ bind <code>$foo</code> to <code>"123"</code>.</p>
+<p>Named arguments are also available to the jq program as
+ <code>$ARGS.named</code>.</p>
+<ul>
+<li><code>--argjson name JSON-text</code>:</li>
+</ul>
+<p>This option passes a JSON-encoded value to the jq program as a
+ predefined variable. If you run jq with <code>--argjson foo 123</code>, then
+ <code>$foo</code> is available in the program and has the value <code>123</code>.</p>
+<ul>
+<li><code>--slurpfile variable-name filename</code>:</li>
+</ul>
+<p>This option reads all the JSON texts in the named file and binds
+ an array of the parsed JSON values to the given global variable.
+ If you run jq with <code>--slurpfile foo bar</code>, then <code>$foo</code> is available
+ in the program and has an array whose elements correspond to the
+ texts in the file named <code>bar</code>.</p>
+<ul>
+<li><code>--rawfile variable-name filename</code>:</li>
+</ul>
+<p>This option reads in the named file and binds its contents to the given
+ global variable. If you run jq with <code>--rawfile foo bar</code>, then <code>$foo</code> is
+ available in the program and has a string whose contents are to the texts
+ in the file named <code>bar</code>.</p>
+<ul>
+<li><code>--args</code>:</li>
+</ul>
+<p>Remaining arguments are positional string arguments. These are
+ available to the jq program as <code>$ARGS.positional[]</code>.</p>
+<ul>
+<li><code>--jsonargs</code>:</li>
+</ul>
+<p>Remaining arguments are positional JSON text arguments. These
+ are available to the jq program as <code>$ARGS.positional[]</code>.</p>
+<ul>
+<li><code>--exit-status</code> / <code>-e</code>:</li>
+</ul>
+<p>Sets the exit status of jq to 0 if the last output value was
+ neither <code>false</code> nor <code>null</code>, 1 if the last output value was
+ either <code>false</code> or <code>null</code>, or 4 if no valid result was ever
+ produced. Normally jq exits with 2 if there was any usage
+ problem or system error, 3 if there was a jq program compile
+ error, or 0 if the jq program ran.</p>
+<p>Another way to set the exit status is with the <code>halt_error</code>
+ builtin function.</p>
+<ul>
+<li><code>--binary</code> / <code>-b</code>:</li>
+</ul>
+<p>Windows users using WSL, MSYS2, or Cygwin, should use this option
+ when using a native jq.exe, otherwise jq will turn newlines (LFs)
+ into carriage-return-then-newline (CRLF).</p>
+<ul>
+<li><code>--version</code> / <code>-V</code>:</li>
+</ul>
+<p>Output the jq version and exit with zero.</p>
+<ul>
+<li><code>--build-configuration</code>:</li>
+</ul>
+<p>Output the build configuration of jq and exit with zero.
+ This output has no supported format or structure and may change
+ without notice in future releases.</p>
+<ul>
+<li><code>--help</code> / <code>-h</code>:</li>
+</ul>
+<p>Output the jq help and exit with zero.</p>
+<ul>
+<li><code>--</code>:</li>
+</ul>
+<p>Terminates argument processing. Remaining arguments are
+ positional, either strings, JSON texts, or input filenames,
+ according to whether <code>--args</code> or <code>--jsonargs</code> were given.</p>
+<ul>
+<li><code>--run-tests [filename]</code>:</li>
+</ul>
+<p>Runs the tests in the given file or standard input. This must
+ be the last option given and does not honor all preceding
+ options. The input consists of comment lines, empty lines, and
+ program lines followed by one input line, as many lines of
+ output as are expected (one per output), and a terminating empty
+ line. Compilation failure tests start with a line containing
+ only <code>%%FAIL</code>, then a line containing the program to compile,
+ then a line containing an error message to compare to the
+ actual.</p>
+<p>Be warned that this option can change backwards-incompatibly.</p>
+ </section>
+ <section id="basic-filters">
+ <h2>Basic filters <a href="#basic-filters" class="icon-link" aria-label="Link to this section: Basic filters"><span class="bi bi-link-45deg" aria-hidden="true"></span></a></h2>
+
+ <section id="identity">
+ <h3>
+ Identity: <code>.</code>
+ <a href="#identity" class="icon-link" aria-label="Link to this section: Identity: `.`"><span class="bi bi-link-45deg" aria-hidden="true"></span></a>
+ </h3>
+ <p>The absolute simplest filter is <code>.</code> . This filter takes its
+input and produces the same value as output. That is, this
+is the identity operator.</p>
+<p>Since jq by default pretty-prints all output, a trivial
+program consisting of nothing but <code>.</code> can be used to format
+JSON output from, say, <code>curl</code>.</p>
+<p>Although the identity filter never modifies the value of its
+input, jq processing can sometimes make it appear as though
+it