summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2024-07-12 15:44:35 +0000
committergithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2024-07-12 15:44:35 +0000
commit5015cf3f50a7f6a8f41e1e99336a3d6e7ac02a60 (patch)
tree4bb653f6df629aaf8b587e8124f970a7e6f4a2bc
parent342c8371d91cad262428a713573f251f8a942a3d (diff)
Update website
-rw-r--r--manual/dev/index.html8451
-rw-r--r--manual/index.html387
-rw-r--r--manual/v1.3/index.html13
-rw-r--r--manual/v1.4/index.html13
-rw-r--r--manual/v1.5/index.html13
-rw-r--r--manual/v1.6/index.html13
-rw-r--r--manual/v1.7/index.html13
7 files changed, 8638 insertions, 265 deletions
diff --git a/manual/dev/index.html b/manual/dev/index.html
new file mode 100644
index 00000000..e4317ce7
--- /dev/null
+++ b/manual/dev/index.html
@@ -0,0 +1,8451 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <title>jq Manual (development version)</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/dev/">
+ <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="#comments">Comments</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 Manual (development version)</h1>
+ <p>
+ <em>
+ For other versions, see
+ <a href="/jq/manual/v1.7/">1.7</a>,
+ <a href="/jq/manual/v1.6/">1.6</a>,
+ <a href="/jq/manual/v1.5/">1.5</a>,
+ <a href="/jq/manual/v1.4/">1.4</a>,
+ <a href="/jq/manual/v1.3/">1.3</a> or
+ <a href="/jq/manual/dev/">development version</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.</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 not
+ interpreted as options.</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 does. For example, using the current implementation of
+jq, we would see that the expression:</p>
+<pre><code>1E1234567890 | .
+</code></pre>
+<p>produces <code>1.7976931348623157e+308</code> on at least one platform.
+This is because, in the process of parsing the number, this
+particular version of jq has converted it to an IEEE754
+double-precision representation, losing precision.</p>
+<p>The way in which jq handles numbers has changed over time
+and further changes are likely within the parameters set by
+the relevant JSON standards. Moreover, build configuration
+options can alter how jq processes numbers.</p>
+<p>The following remarks are therefore offered with the
+understanding that they are intended to be descriptive of the
+current version of jq and should not be interpreted as being
+prescriptive:</p>
+<p>(1) Any arithmetic operation on a number that has not
+already been converted to an IEEE754 double precision
+representation will trigger a conversion to the IEEE754
+representation.</p>
+<p>(2) jq will attempt to maintain the original decimal
+precision of number literals (if the <code>--disable-decnum</code>
+build configuration option was not used), but in expressions
+such <code>1E1234567890</code>, precision will be lost if the exponent
+is too large.</p>
+<p>(3) In jq programs, a leading minus sign will trigger the
+conversion of the number to an IEEE754 representation.</p>
+<p>(4) Comparisons are carried out using the untruncated
+big decimal representation of numbers if available, as
+illustrated in one of the following examples.</p>
+<p>The examples below use the builtin function <code>have_decnum</code> in
+order to demonstrate the expected effects of using / not
+using the <code>--disable-decnum</code> build configuration option, and
+also to allow automated tests derived from these examples to
+pass regardless of whether that option is used.</p>
+ <div class="pb-3">
+ <button type="button" class="btn btn-sm btn-secondary text-body-secondary bg-transparent link-body-emphasis border-0" data-bs-toggle="collapse" data-bs-target="#example1" aria-expanded="false" aria-controls="example1">
+ <span class="me-1 d-print-none" aria-hidden="true"><span class="bi bi-chevron-right"></span><span class="bi bi-chevron-down"></span></span>Examples
+ </button>
+ <div id="example1" class="collapse mx-3 small d-print-block">
+ <table class="table table-borderless table-sm w-auto">
+ <tr>
+ <th class="pe-3">Command</th>
+ <td class="font-monospace">jq '.'</td>
+ </tr>
+ <tr>
+ <th>Input</th>
+ <td class="font-monospace">&#34;Hello, world!&#34;</td>
+ </tr>
+ <tr>
+ <th>Output</th>
+ <td class="font-monospace">&#34;Hello, world!&#34;</td>
+ </tr>
+ <tr class="d-print-none">
+ <th><a href="https://jqplay.org/jq?q=.&j=%22Hello%2C%20world%21%22" class="btn btn-outline-primary btn-sm" target="_blank" rel="noopener">Run<span class="bi bi-box-arrow-up-right ms-2" aria-hidden="true"></span></a></th>
+ <td></td>
+ </tr>
+ </table>
+ <table class="table table-borderless table-sm w-auto">
+ <tr>
+ <th class="pe-3">Command</th>
+ <td class="font-monospace">jq '.'</td>
+ </tr>
+ <tr>
+ <th>Input</th>
+ <td class="font-monospace">0.12345678901234567890123456789</td>
+ </tr>
+ <tr>
+ <th>Output</th>
+ <td class="font-monospace">0.12345678901234567890123456789</td>
+ </tr>
+ <tr class="d-print-none">
+ <th><a href="https://jqplay.org/jq?q=.&j=0.12345678901234567890123456789" class="btn btn-outline-primary btn-sm" target="_blank" rel="noopener">Run<span class="bi bi-box-arrow-up-right ms-2" aria-hidden="true"></span></a></th>
+ <td></td>
+ </tr>
+ </table>
+ <table class="table table-borderless table-sm w-auto">
+ <tr>
+ <th class="pe-3">Command</th>
+ <td class="font-monospace">jq '[., tojson] | . == if have_decnum then [12345678909876543212345,&#34;12345678909876543212345&#34;] else [12345678909876543000000,&#34;12345678909876543000000&#34;] end'</td>
+ </tr>
+ <tr>
+ <th>Input</th>
+ <td class="font-monospace">12345678909876543212345</td>
+ </tr>
+ <tr>
+ <th>Output</th>
+ <td class="font-monospace">true</td>
+ </tr>
+ <tr class="d-print-none">
+ <th><a href="https://jqplay.org/jq?q=%5B.%2C%20tojson%5D%20%7C%20.%20%3D%3D%20if%20have_decnum%20then%20%5B12345678909876543212345%2C%2212345678909876543212345%22%5D%20else%20%5B12345678909876543000000%2C%2212345678909876543000000%22%5D%20end&j=12345678909876543212345" class="btn btn-outline-primary btn-sm" target="_blank" rel="noopener">Run<span class="bi bi-box-arrow-up-right ms-2" aria-hidden="true"></span></a></th>
+ <td></td>
+ </tr>
+ </table>
+ <table class="table table-borderless table-sm w-auto">
+ <tr>
+ <th class="pe-3">Command</th>
+ <td class="font-monospace">jq '. &lt; 0.12345678901234567890123456788'</td>
+ </tr>
+ <tr>
+ <th>Input</th>
+ <td class="font-monospace">0.12345678901234567890123456789</td>
+ </tr>
+ <tr>
+ <th>Output</th>
+ <td class="font-monospace">false</td>
+ </tr>
+ <tr class="d-print-none">
+ <th><a href="https://jqplay.org/jq?q=.%20%3C%200.12345678901234567890123456788&j=0.12345678901234567890123456789" class="btn btn-outline-primary btn-sm" target="_blank" rel="noopener">Run<span class="bi bi-box-arrow-up-right ms-2" aria-hidden="true"></span></a></th>
+ <td></td>
+ </tr>
+ </table>
+ <table class="table table-borderless table-sm w-auto">
+ <tr>
+ <th class="pe-3">Command</th>
+ <td class="font-monospace">jq 'map([., . == 1]) | tojson | . == if have_decnum then &#34;[[1,true],[1.000,true],[1.0,true],[1.00,true]]&#34; else &#34;[[1,true],[1,true],[1,true],[1,true]]&#34; end'</td>
+ </tr>
+ <tr>
+ <th>Input</th>
+ <td class="font-monospace">[1, 1.000, 1.0, 100e-2]</td>
+ </tr>
+ <tr>
+ <th>Output</th>
+ <td class="font-monospace">true</td>
+ </tr>
+ <tr class="d-print-none">
+ <th><a href="https://jqplay.org/jq?q=map%28%5B.%2C%20.%20%3D%3D%201%5D%29%20%7C%20tojson%20%7C%20.%20%3D%3D%20if%20have_decnum%20then%20%22%5B%5B1%2Ctrue%5D%2C%5B1.000%2Ctrue%5D%2C%5B1.0%2Ctrue%5D%2C%5B1.00%2Ctrue%5D%5D%22%20else%20%22%5B%5B1%2Ctrue%5D%2C%5B1%2Ctrue%5D%2C%5B1%2Ctrue%5D%2C%5B1%2Ctrue%5D%5D%22%20end&j=%5B1%2C%201.000%2C%201.0%2C%20100e-2%5D" class="btn btn-outline-primary btn-sm" target="_blank" rel="noopener">Run<span class="bi bi-box-arrow-up-right ms-2" aria-hidden="true"></span></a></th>
+ <td></td>
+ </tr>
+ </table>
+ <table class="table table-borderless table-sm w-auto">
+ <tr>
+ <th class="pe-3">Command</th>
+ <td class="font-monospace">jq '. as $big | [$big, $big + 1] | map(. &gt; 10000000000000000000000000000000) | . == if have_decnum then [true, false] else [false, false] end'</td>
+ </tr>
+ <tr>
+ <th>Input</th>
+ <td class="font-monospace">10000000000000000000000000000001</td>
+ </tr>
+ <tr>
+ <th>Output</th>
+ <td class="font-monospace">true</td>
+ </tr>
+ <tr class="d-print-none">
+ <th><a href="https://jqplay.org/jq?q=.%20as%20%24big%20%7C%20%5B%24big%2C%20%24big%20%2B%201%5D%20%7C%20map%28.%20%3E%2010000000000000000000000000000000%29%20%7C%20.%20%3D%3D%20if%20have_decnum%20then%20%5Btrue%2C%20false%5D%20else%20%5Bfalse%2C%20false%5D%20end&j=10000000000000000000000000000001" class="btn btn-outline-primary btn-sm" target="_blank" rel="noopener">Run<span class="bi bi-box-arrow-up-right ms-2" aria-hidden="true"></span></a></th>
+ <td></td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ </section>
+ <section id="object-identifier-index">
+ <h3>
+ Object Identifier-Index: <code>.foo</code>, <code>.foo.bar</code>
+ <a href="#object-identifier-index" class="icon-link" aria-label="Link to this section: Object Identifier-Index: `.foo`, `.foo.bar`"><span class="bi bi-link-45deg" aria-hidden="true"></span></a>
+ </h3>
+ <p>The simplest <em>useful</em> filter has the form <code>.foo</code>. When given a
+JSON object (aka dictionary or hash) as input, <code>.foo</code> produces
+the value at the key "foo" if the key is present, or null otherwise.</p>
+<p>A filter of the form <code>.foo.bar</code> is equivalent to <code>.foo | .bar</code>.</p>
+<p>The <code>.foo</code> syntax only works for simple, identifier-like keys, that
+is, keys that are all made of alphanumeric characters and
+underscore, and which do not start with a digit.</p>
+<p>If the key contains special characters or starts with a digit,
+you need to surround it with double quotes like this:
+<code>."foo$"</code>, or else <code>.["foo$"]</code>.</p>
+<p>For example <code>.["foo::bar"]</code> and <code>.["foo.bar"]</code> work while
+<code>.foo::bar</code> does not.</p>
+ <div class="pb-3">
+ <button type="button" class="btn btn-sm btn-secondary text-body-secondary bg-transparent link-body-emphasis border-0" data-bs-toggle="collapse" data-bs-target="#example2" aria-expanded="false" aria-controls="example2">
+ <span class="me-1 d-print-none" aria-hidden="true"><span class="bi bi-chevron-right"></span><span class="bi bi-chevron-down"></span></span>Examples
+ </button>
+ <div id="example2" class="collapse mx-3 small d-print-block">
+ <table class="table table-borderless table-sm w-auto">
+ <tr>
+ <th class="pe-3">Command</th>
+ <td class="font-monospace">jq '.foo'</td>
+ </tr>
+ <tr>
+ <th>Input</th>
+ <td class="font-monospace">{&#34;foo&#34;: 42, &#34;bar&#34;: &#34;less interesting data&#34;}</td>
+ </tr>
+ <tr>
+ <th>Output</th>
+ <td class="font-monospace">42</td>
+ </tr>
+ <tr class="d-print-none">
+ <th><a href="https://jqplay.org/jq?q=.foo&j=%7B%22foo%22%3A%2042%2C%20%22bar%22%3A%20%22less%20interesting%20data%22%7D" class="btn btn-outline-primary btn-sm" target="_blank" rel="noopener">Run<span class="bi bi-box-arrow-up-right ms-2" aria-hidden="true"></span></a></th>
+ <td></td>
+ </tr>
+ </table>
+ <table class="table table-borderless table-sm w-auto">
+ <tr>
+ <th class="pe-3">Command</th>
+ <td class="font-monospace">jq '.foo'</td>
+ </tr>
+ <tr>
+ <th>Input</th>
+ <td class="font-monospace">{&#34;notfoo&#34;: true, &#34;alsonotfoo&#34;: false}</td>
+ </tr>
+ <tr>
+ <th>Output</th>
+ <td class="font-monospace">null</td>
+ </tr>
+ <tr class="d-print-none">
+ <th><a href="https://jqplay.org/jq?q=.foo&j=%7B%22notfoo%22%3A%20true%2C%20%22alsonotfoo%22%3A%20false%7D" class="btn btn-outline-primary btn-sm" target="_blank" rel="noopener">Run<span class="bi bi-box-arrow-up-right ms-2" aria-hidden="true"></span></a></th>
+ <td></td>
+ </tr>
+ </table>
+ <table class="table table-borderless table-sm w-auto">
+ <tr>
+