summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2015-07-23 21:58:22 -0700
committerDavid Tolnay <dtolnay@gmail.com>2015-07-23 21:58:22 -0700
commit3a225ab069e1faea33af9d4678a5d286faf16c61 (patch)
tree8b8060bb37856948b8de88fa7fd40bb42eeb08de
parent702c17984b383f57a175772d30f4574d09fc4b33 (diff)
Update site from master
-rw-r--r--download/index.html24
-rw-r--r--index.html11
-rw-r--r--index/index.html12
-rw-r--r--manual/index.html2933
-rw-r--r--sitemap.xml12
-rw-r--r--tutorial/index.html4
6 files changed, 2485 insertions, 511 deletions
diff --git a/download/index.html b/download/index.html
index 95696a5a..e94a9d83 100644
--- a/download/index.html
+++ b/download/index.html
@@ -81,7 +81,7 @@
</li>
<li>
-<p>jq 1.3.2 is in the official Fedora repository. You can install using <code>sudo yum install jq</code></p>
+<p>jq 1.3.2 is in the official Fedora repository. You can install using <code>sudo yum install jq</code>.</p>
</li>
</ul>
@@ -101,20 +101,32 @@
</li>
</ul>
-<h3 id='solaris_11'>Solaris 11</h3>
+<h3 id='solaris'>Solaris</h3>
<ul>
-<li>jq 1.4 executables for <a href='solaris11-64/jq.exe'>64-bit</a> or <a href='solaris11-32/jq.exe'>32-bit</a></li>
+<li>
+<p><code>pkgutil -i jq</code> in <a href='http://www.opencsw.org/p/jq'>OpenCSW</a> for Solaris 10+, Sparc and x86</p>
+</li>
+
+<li>
+<p>jq 1.4 executables for Solaris 11 <a href='solaris11-64/jq'>64-bit</a> or <a href='solaris11-32/jq'>32-bit</a></p>
+</li>
</ul>
<h3 id='windows'>Windows</h3>
+
<ul>
<li>
-<p><code>chocolatey install jq</code> using <a href="https://chocolatey.org/">Chocolatey NuGet</a></p>
+<p><code>chocolatey install jq</code> using <a href='https://chocolatey.org/'>Chocolatey NuGet</a></p>
</li>
-<li>jq 1.4 executables for <a href='win64/jq.exe'>64-bit</a> or <a href='win32/jq.exe'>32-bit</a></li>
-<li>jq 1.3 executables for <a href='win64/jq-1.3/jq.exe'>64-bit</a> or <a href='win32/jq-1.3/jq.exe'>32-bit</a></li>
+<li>
+<p>jq 1.4 executables for <a href='win64/jq.exe'>64-bit</a> or <a href='win32/jq.exe'>32-bit</a></p>
+</li>
+
+<li>
+<p>jq 1.3 executables for <a href='win64/jq-1.3/jq.exe'>64-bit</a> or <a href='win32/jq-1.3/jq.exe'>32-bit</a></p>
+</li>
</ul>
<h3 id='from_source_on_linux_os_x_cygwin_and_other_posixlike_operating_systems'>From source on Linux, OS X, Cygwin, and other POSIX-like operating systems</h3>
diff --git a/index.html b/index.html
index d82eb40e..461e68b8 100644
--- a/index.html
+++ b/index.html
@@ -87,14 +87,18 @@ and map and transform structured data with the same ease that <code>sed</code>,
<code>awk</code>, <code>grep</code> and friends let you play with text.</p></div>
<div class="span4"><p>jq is written in portable C, and it has zero runtime
dependencies. You can download a single binary, <code>scp</code> it to a far away
-machine, and expect it to work.</p></div>
+machine of the same type, and expect it to work.</p></div>
<div class="span4"><p>jq can mangle the data format that you have into the one that you
want with very little effort, and the program to do so is often
shorter and simpler than you&rsquo;d expect.</p></div>
</div>
<div class="row" style="text-align:center; margin-top: 30px">
<p>Go read the <a href='tutorial/'>tutorial</a> for more, or the <a href='manual/'>manual</a>
-for <em>way</em> more. Ask questions over on <a href="http://stackoverflow.com/">stackoverflow</a> using the <a href="http://stackoverflow.com/questions/tagged/jq">jq</a> tag, or on the <a href="http://irc.lc/freenode/%23jq/">#jq</a> channel over on <a href="https://webchat.freenode.net/">Freenode</a>.</p>
+for <em>way</em> more. Ask questions over on
+<a href='http://stackoverflow.com/'>stackoverflow</a> using the <a href='http://stackoverflow.com/questions/tagged/jq'>jq
+tag</a>, or on the
+<a href='http://irc.lc/freenode/%23jq/'>#jq</a> channel over on
+<a href='https://webchat.freenode.net/'>Freenode</a>.</p>
</div>
<div class="row">
<h2>News</h2>
@@ -102,11 +106,10 @@ for <em>way</em> more. Ask questions over on <a href="http://stackoverflow.com/
<ul>
<li><span class="date">01 January 2015</span><p>jq 1.5rc1 Get it on the <a href='https://github.com/stedolan/jq/releases'>releases</a> page.</p></li>
-
+
<li><span class="date">06 June 2014</span><p>jq 1.4 (finally) released! Get it on the <a href='download/'>download</a> page.</p></li>
<li><span class="date">05 May 2013</span><p>jq 1.3 released.</p></li>
-
</ul>
</div>
diff --git a/index/index.html b/index/index.html
index 0c4dc920..461e68b8 100644
--- a/index/index.html
+++ b/index/index.html
@@ -72,7 +72,7 @@
<div class="btn-group" style="float:right">
<a class="btn btn-primary" href="http://jqplay.org">
- Try online!
+ Try online at jqplay.org!
</a>
</div>
@@ -87,20 +87,26 @@ and map and transform structured data with the same ease that <code>sed</code>,
<code>awk</code>, <code>grep</code> and friends let you play with text.</p></div>
<div class="span4"><p>jq is written in portable C, and it has zero runtime
dependencies. You can download a single binary, <code>scp</code> it to a far away
-machine, and expect it to work.</p></div>
+machine of the same type, and expect it to work.</p></div>
<div class="span4"><p>jq can mangle the data format that you have into the one that you
want with very little effort, and the program to do so is often
shorter and simpler than you&rsquo;d expect.</p></div>
</div>
<div class="row" style="text-align:center; margin-top: 30px">
<p>Go read the <a href='tutorial/'>tutorial</a> for more, or the <a href='manual/'>manual</a>
-for <em>way</em> more.</p>
+for <em>way</em> more. Ask questions over on
+<a href='http://stackoverflow.com/'>stackoverflow</a> using the <a href='http://stackoverflow.com/questions/tagged/jq'>jq
+tag</a>, or on the
+<a href='http://irc.lc/freenode/%23jq/'>#jq</a> channel over on
+<a href='https://webchat.freenode.net/'>Freenode</a>.</p>
</div>
<div class="row">
<h2>News</h2>
<div id="news">
<ul>
+ <li><span class="date">01 January 2015</span><p>jq 1.5rc1 Get it on the <a href='https://github.com/stedolan/jq/releases'>releases</a> page.</p></li>
+
<li><span class="date">06 June 2014</span><p>jq 1.4 (finally) released! Get it on the <a href='download/'>download</a> page.</p></li>
<li><span class="date">05 May 2013</span><p>jq 1.3 released.</p></li>
diff --git a/manual/index.html b/manual/index.html
index bec35ae6..b5f85019 100644
--- a/manual/index.html
+++ b/manual/index.html
@@ -76,13 +76,33 @@
</li>
<li >
+ <a href="#RegularexpressionsPCRE">Regular expressions (PCRE)</a>
+ </li>
+
+ <li >
<a href="#Advancedfeatures">Advanced features</a>
</li>
<li >
+ <a href="#Math">Math</a>
+ </li>
+
+ <li >
+ <a href="#IO">I/O</a>
+ </li>
+
+ <li >
+ <a href="#Streaming">Streaming</a>
+ </li>
+
+ <li >
<a href="#Assignment">Assignment</a>
</li>
+ <li >
+ <a href="#Modules">Modules</a>
+ </li>
+
</ul>
<form class="form-search">
<script type="text/javascript">
@@ -129,33 +149,41 @@
"`length`" : "length",
- "`keys`" : "keys",
+ "`keys`, `keys_unsorted`" : "keyskeys_unsorted",
"`has(key)`" : "haskey",
+ "`in`" : "in",
+
+ "`path(path_expression)`" : "pathpath_expression",
+
"`del(path_expression)`" : "delpath_expression",
"`to_entries`, `from_entries`, `with_entries`" : "to_entriesfrom_entrieswith_entries",
"`select(boolean_expression)`" : "selectboolean_expression",
- "`arrays`, `objects`, `iterables`, `booleans`, `numbers`, `strings`, `nulls`, `values`, `scalars`" : "arraysobjectsiterablesbooleansnumbersstringsnullsvaluesscalars",
+ "`arrays`, `objects`, `iterables`, `booleans`, `numbers`, `normals`, `finites`, `strings`, `nulls`, `values`, `scalars`" : "arraysobjectsiterablesbooleansnumbersnormalsfinitesstringsnullsvaluesscalars",
"`empty`" : "empty",
- "`map(x)`" : "mapx",
+ "`error(message)`" : "errormessage",
+
+ "`$__loc__`" : "__loc__",
+
+ "`map(x)`, `map_values(x)`" : "mapxmap_valuesx",
"`paths`, `paths(node_filter)`, `leaf_paths`" : "pathspathsnode_filterleaf_paths",
"`add`" : "add",
- "`any`" : "any",
+ "`any`, `any(condition)`, `any(generator; condition)`" : "anyanyconditionanygeneratorcondition",
- "`all`" : "all",
+ "`all`, `all(condition)`, `all(generator; condition)`" : "allallconditionallgeneratorcondition",
- "`flatten`, `flatten(depth)`" : "flattenflattendepth",
+ "\\[Requires 1.5\\] `flatten`, `flatten(depth)`" : "Requires15flattenflattendepth",
- "`range(upto)`, `range(from;upto)`" : "rangeuptorangefromupto",
+ "`range(upto)`, `range(from;upto)` `range(from;upto;by)`" : "rangeuptorangefromuptorangefromuptoby",
"`floor`" : "floor",
@@ -167,13 +195,15 @@
"`type`" : "type",
- "`sort, sort(path_expression), sort_by(path_expression)`" : "sortsortpath_expressionsort_bypath_expression",
+ "`infinite`, `nan`, `isinfinite`, `isnan`, `isfinite`, `isnormal`" : "infinitenanisinfiniteisnanisfiniteisnormal",
- "`group(path_expression)`, `group_by(path_expression)`" : "grouppath_expressiongroup_bypath_expression",
+ "`sort, sort_by(path_expression)`" : "sortsort_bypath_expression",
- "`min`, `max`, `min(path_exp)`, `max(path_exp)`, `min_by(path_exp)`, `max_by(path_exp)`" : "minmaxminpath_expmaxpath_expmin_bypath_expmax_bypath_exp",
+ "`group_by(path_expression)`" : "group_bypath_expression",
- "`unique`, `unique(path_exp)`, `unique_by(path_exp)`" : "uniqueuniquepath_expunique_bypath_exp",
+ "`min`, `max`, `min_by(path_exp)`, `max_by(path_exp)`" : "minmaxmin_bypath_expmax_bypath_exp",
+
+ "`unique`, `unique_by(path_exp)`" : "uniqueunique_bypath_exp",
"`reverse`" : "reverse",
@@ -183,17 +213,13 @@
"`index(s)`, `rindex(s)`" : "indexsrindexs",
+ "`inside`" : "inside",
+
"`startswith(str)`" : "startswithstr",
"`endswith(str)`" : "endswithstr",
- "`match(val)`, `match(regex; modifiers)`" : "matchvalmatchregexmodifiers",
-
- "`test(val)`, `test(regex)`, `test(regex; modifiers)`" : "testvaltestregextestregexmodifiers",
-
- "`sub(re; sub)`, `gsub(re; sub)`" : "subresubgsubresub",
-
- "`scan(re)`, `split2(re)`" : "scanresplit2re",
+ "`combinations`, `combinations(n)`" : "combinationscombinationsn",
"`ltrimstr(str)`" : "ltrimstrstr",
@@ -207,18 +233,30 @@
"`join(str)`" : "joinstr",
- "`recurse(f)`, `recurse`, `recurse_down`" : "recursefrecurserecurse_down",
+ "`ascii_downcase`, `ascii_upcase`" : "ascii_downcaseascii_upcase",
+
+ "`while(cond; update)`" : "whilecondupdate",
+
+ "`until(cond; next)`" : "untilcondnext",
+
+ "`recurse(f)`, `recurse`, `recurse(f; condition)`, `recurse_down`" : "recursefrecurserecursefconditionrecurse_down",
"`..`" : "",
"`env`" : "env",
+ "`transpose`" : "transpose",
+
+ "`bsearch(x)`" : "bsearchx",
+
"String interpolation - `\\(foo)`" : "Stringinterpolationfoo",
"Convert to/from JSON" : "ConverttofromJSON",
"Format strings and escaping" : "Formatstringsandescaping",
+ "Dates" : "Dates",
+
"Builtin operators and functions" : "Builtinoperatorsandfunctions"
,
@@ -233,20 +271,86 @@
"Alternative operator - `//`" : "Alternativeoperator",
+ "try-catch" : "trycatch",
+
+ "Breaking out of control structures" : "Breakingoutofcontrolstructures",
+
+ "`?` operator" : "operator",
+
"Conditionals and Comparisons" : "ConditionalsandComparisons"
,
+ "\\[Requires 1.5\\] `test(val)`, `test(regex; flags)`" : "Requires15testvaltestregexflags",
+
+ "\\[Requires 1.5\\] `match(val)`, `match(regex; flags)`" : "Requires15matchvalmatchregexflags",
+
+ "\\[Requires 1.5\\] `capture(val)`, `capture(regex; flags)`" : "Requires15capturevalcaptureregexflags",
+
+ "\\[Requires 1.5\\] `scan(regex)`, `scan(regex; flags)`" : "Requires15scanregexscanregexflags",
+
+ "`split(regex; flags)`" : "splitregexflags",
+
+ "\\[Requires 1.5\\] `splits(regex)`, `splits(regex; flags)`" : "Requires15splitsregexsplitsregexflags",
+
+ "\\[Requires 1.5\\] `sub(regex; tostring)` `sub(regex; string; flags)`" : "Requires15subregextostringsubregexstringflags",
+
+ "\\[Requires 1.5\\] `gsub(regex; string)`, `gsub(regex; string; flags)`" : "Requires15gsubregexstringgsubregexstringflags",
+
+ "Regular expressions (PCRE)" : "RegularexpressionsPCRE"
+ ,
+
+
"Variables" : "Variables",
"Defining Functions" : "DefiningFunctions",
"Reduce" : "Reduce",
+ "`limit(n; exp)`" : "limitnexp",
+
+ "`first(expr)`, `last(expr)`, `nth(n; expr)`" : "firstexprlastexprnthnexpr",
+
+ "`first`, `last`, `nth(n)`" : "firstlastnthn",
+
+ "`foreach`" : "foreach",
+
+ "Recursion" : "Recursion",
+
+ "Generators and iterators" : "Generatorsanditerators",
+
"Advanced features" : "Advancedfeatures"
,
+ "Math" : "Math"
+ ,
+
+
+ "`input`" : "input",
+
+ "`inputs`" : "inputs",
+
+ "`debug`" : "debug",
+
+ "`input_filename`" : "input_filename",
+
+ "`input_line_number`" : "input_line_number",
+
+ "I/O" : "IO"
+ ,
+
+
+ "`truncate_stream(stream_expression)`" : "truncate_streamstream_expression",
+
+ "`fromstream(stream_expression)`" : "fromstreamstream_expression",
+
+ "`tostream`" : "tostream",
+
+ "Streaming" : "Streaming"
+ ,
+
+
"`=`" : "",
"`|=`" : "",
@@ -256,6 +360,20 @@
"Complex assignments" : "Complexassignments",
"Assignment" : "Assignment"
+ ,
+
+
+ "`import RelativePathString as NAME [<metadata>];`" : "importRelativePathStringasNAMEmetadata",
+
+ "`include RelativePathString [<metadata>];`" : "includeRelativePathStringmetadata",
+
+ "`import RelativePathString as $NAME [<metadata>];`" : "importRelativePathStringasNAMEmetadata",
+
+ "`module <metadata>;`" : "modulemetadata",
+
+ "`modulemeta`" : "modulemeta",
+
+ "Modules" : "Modules"
};
@@ -268,20 +386,17 @@
}
});
});
-
- // add "Run" button to execute examples on jqplay.org
- $(function() {
+ // add "Run" button to execute examples on jqplay.org
+ $(function() {
$.each($('table.manual-example'), function(index, value) {
$value = $(value)
-
var j = $value.find('tr:nth-child(2) td:first').text();
var q = $value.find('.jqprogram').text().replace(/^jq /, '').replace(/^'(.+)'$/, '$1');
var url = 'https://jqplay.org/jq?q=' + encodeURIComponent(q) +'&j=' + encodeURIComponent(j)
-
var $last_tr = $value.find('tr:last');
$last_tr.after('<tr><th><a href="' + url + '" class="btn btn-primary btn-small">Run</a></th><th></th></tr><tr><th></th><th></th></tr>');
});
- });
+ });
</script>
<input type="text"
class="input-medium search-query"
@@ -308,7 +423,7 @@ 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> &ndash; feeding the input array both to the <code>add</code>
-filter and the <code>length</code> filter and dividing the results.</p><p>But that&rsquo;s getting ahead of ourselves. :) Let&rsquo;s start with something
+filter and the <code>length</code> filter and then performing the division.</p><p>But that&rsquo;s getting ahead of ourselves. :) Let&rsquo;s start with something
simpler:</p>
<section id="Invokingjq">
@@ -329,6 +444,20 @@ defined</code>. When using the Windows command shell (cmd.exe) it&#8217;s best t
</li>
<li>
+<p><code>--seq</code>:</p>
+
+<p>Use the <code>application/json-seq</code> MIME type scheme for separating JSON texts in jq&#8217;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 more also parses the output of jq without the <code>--seq</code> option.</p>
+</li>
+
+<li>
+<p><code>--stream</code>:</p>
+
+<p>Parse the input in streaming fashion, outputing arrays of path and leaf values (scalars and empty arrays or empty objects). For example, <code>&quot;a&quot;</code> becomes <code>[[],&quot;a&quot;]</code>, and <code>[[],&quot;a&quot;,[&quot;b&quot;]]</code> becomes <code>[[0],[]]</code>, <code>[[1],&quot;a&quot;]</code>, and <code>[[1,0],&quot;b&quot;]</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>
+</li>
+
+<li>
<p><code>--slurp</code>/<code>-s</code>:</p>
<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>
@@ -353,6 +482,18 @@ defined</code>. When using the Windows command shell (cmd.exe) it&#8217;s best t
</li>
<li>
+<p><code>--tab</code>:</p>
+
+<p>Use a tab for each indentation level instead of two spaces.</p>
+</li>
+
+<li>
+<p><code>--indent n</code>:</p>
+
+<p>Use the given number of spaces (no more than 8) for indentation.</p>
+</li>
+
+<li>
<p><code>--colour-output</code> / <code>-C</code> and <code>--monochrome-output</code> / <code>-M</code>:</p>
<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>.</p>
@@ -395,6 +536,12 @@ defined</code>. When using the Windows command shell (cmd.exe) it&#8217;s best t
</li>
<li>
+<p><code>-Ldirectory</code> / <code>-L directory</code>:</p>
+
+<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>
+</li>
+
+<li>
<p><code>-e</code> / <code>--exit-status</code>:</p>
<p>Sets the exit status of jq to 0 if the last output values 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>
@@ -403,13 +550,35 @@ defined</code>. When using the Windows command shell (cmd.exe) it&#8217;s best t
<li>
<p><code>--arg name value</code>:</p>
-<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>&quot;bar&quot;</code>.</p>
+<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>&quot;bar&quot;</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>&quot;123&quot;</code>.</p>
</li>
<li>
-<p><code>--argfile name filename</code>:</p>
+<p><code>--argjson name JSON-text</code>:</p>
-<p>This option passes the first value from the named file as a value to the jq program as a predefined variable. If you run jq with <code>--argfile foo bar</code>, then <code>$foo</code> is available in the program and has the value resulting from parsing the content of the file named <code>bar</code>.</p>
+<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>
+</li>
+
+<li>
+<p><code>--slurpfile variable-name filename</code>:</p>
+
+<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>--argfile 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>
+</li>
+
+<li>
+<p><code>--argfile variable-name filename</code>:</p>
+
+<p>Do not use. Use <code>--slurpfile</code> instead.</p>
+
+<p>(This option is like <code>--slurpfile</code>, but when the file has just one text, then that is used, else an array of texts is used as in <code>--slurfile</code>.)</p>
+</li>
+
+<li>
+<p><code>--run-tests [filename]</code>:</p>
+
+<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 consts 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 &#8220;%%FAIL&#8221;, 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>
</li>
</ul>
@@ -440,14 +609,14 @@ defined</code>. When using the Windows command shell (cmd.exe) it&#8217;s best t
<table class="manual-example">
<tr><th></th><td class="jqprogram">jq '.'</td></tr>
- <tr><th>Input</th><td>"Hello, world!"</td></tr>
+ <tr><th>Input</th><td>&quot;Hello, world!&quot;</td></tr>
<tr>
<th>Output</th>
- <td>"Hello, world!"</td>
+ <td>&quot;Hello, world!&quot;</td>
</tr>
@@ -481,7 +650,7 @@ defined</code>. When using the Windows command shell (cmd.exe) it&#8217;s best t
<table class="manual-example">
<tr><th></th><td class="jqprogram">jq '.foo'</td></tr>
- <tr><th>Input</th><td>{"foo": 42, "bar": "less interesting data"}</td></tr>
+ <tr><th>Input</th><td>{&quot;foo&quot;: 42, &quot;bar&quot;: &quot;less interesting data&quot;}</td></tr>
<tr>
@@ -496,7 +665,7 @@ defined</code>. When using the Windows command shell (cmd.exe) it&#8217;s best t
<table class="manual-example">
<tr><th></th><td class="jqprogram">jq '.foo'</td></tr>
- <tr><th>Input</th><td>{"notfoo": true, "alsonotfoo": false}</td></tr>
+ <tr><th>Input</th><td>{&quot;notfoo&quot;: true, &quot;alsonotfoo&quot;: false}</td></tr>
<tr>
@@ -510,8 +679,8 @@ defined</code>. When using the Windows command shell (cmd.exe) it&#8217;s best t
</table>
<table class="manual-example">
- <tr><th></th><td class="jqprogram">jq '.["foo"]'</td></tr>
- <tr><th>Input</th><td>{"foo": 42}</td></tr>
+ <tr><th></th><td class="jqprogram">jq '.[&quot;foo&quot;]'</td></tr>
+ <tr><th>Input</th><td>{&quot;foo&quot;: 42}</td></tr>
<tr>
@@ -548,7 +717,7 @@ defined</code>. When using the Windows command shell (cmd.exe) it&#8217;s best t
<table class="manual-example">
<tr><th></th><td class="jqprogram">jq '.foo?'</td></tr>
- <tr><th>Input</th><td>{"foo": 42, "bar": "less interesting data"}</td></tr>
+ <tr><th>Input</th><td>{&quot;foo&quot;: 42, &quot;bar&quot;: &quot;less interesting data&quot;}</td></tr>
<tr>
@@ -563,7 +732,7 @@ defined</code>. When using the Windows command shell (cmd.exe) it&#8217;s best t
<table class="manual-example">
<tr><th></th><td class="jqprogram">jq '.foo?'</td></tr>
- <tr><th>Input</th><td>{"notfoo": true, "alsonotfoo": false}</td></tr>
+ <tr><th>Input</th><td>{&quot;notfoo&quot;: true, &quot;alsonotfoo&quot;: false}</td></tr>
<tr>
@@ -577,8 +746,8 @@ defined</code>. When using the Windows command shell (cmd.exe) it&#8217;s best t
</table>
<table class="manual-example">
- <tr><th></th><td class="jqprogram">jq '.["foo"]?'</td></tr>
- <tr><th>Input</th><td>{"foo": 42}</td></tr>
+ <tr><th></th><td class="jqprogram">jq '.[&quot;foo&quot;]?'</td></tr>
+ <tr><th>Input</th><td>{&quot;foo&quot;: 42}</td></tr>
<tr>
@@ -620,6 +789,10 @@ defined</code>. When using the Windows command shell (cmd.exe) it&#8217;s best t
<p>The <code>.[10:15]</code> syntax can be used to return a subarray of an array or substring of a string. The array returned by <code>.[10:15]</code> will be of length 5, containing the elements from index 10 (inclusive) to index 15 (exclusive). Either index may be negative (in which case it counts backwards from the end of the array), or omitted (in which case it refers to the start or end of the array).</p>
+<p>The <code>.[2]</code> syntax can be used to return the element at the given index. Negative indices are allowed, with -1 referring to the last element, -2 referring to the next to last element, and so on.</p>
+
+<p>The <code>.foo</code> syntax only works for simply keys i.e. keys that are all alphanumeric characters. <code>.[&lt;string&gt;]</code> works with keys that contain special charactors such as colons and dots. For example <code>.[&quot;foo::bar&quot;]</code> and <code>.[&quot;foo.bar&quot;]</code> work while <code>.foo::bar</code> and <code>.foo.bar</code> would not.</p>
+
<p>The <code>?</code> &#8220;operator&#8221; can also be used with the slice operator, as in <code>.[10:15]?</code>, which outputs values where the inputs are slice-able.</p>
@@ -634,14 +807,14 @@ defined</code>. When using the Windows command shell (cmd.exe) it&#8217;s best t
<table class="manual-example">
<tr><th></th><td class="jqprogram">jq '.[0]'</td></tr>
- <tr><th>Input</th><td>[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]</td></tr>
+ <tr><th>Input</th><td>[{&quot;name&quot;:&quot;JSON&quot;, &quot;good&quot;:true}, {&quot;name&quot;:&quot;XML&quot;, &quot;good&quot;:false}]</td></tr>
<tr>
<th>Output</th>
- <td>{"name":"JSON", "good":true}</td>
+ <td>{&quot;name&quot;:&quot;JSON&quot;, &quot;good&quot;:true}</td>
</tr>
@@ -649,7 +822,7 @@ defined</code>. When using the Windows command shell (cmd.exe) it&#8217;s best t
<table class="manual-example">
<tr><th></th><td class="jqprogram">jq '.[2]'</td></tr>
- <tr><th>Input</th><td>[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]</td></tr>
+ <tr><th>Input</th><td>[{&quot;name&quot;:&quot;JSON&quot;, &quot;good&quot;:true}, {&quot;name&quot;:&quot;XML&quot;, &quot;good&quot;:false}]</td></tr>
<tr>
@@ -664,14 +837,14 @@ defined</code>. When using the Windows command shell (cmd.exe) it&#8217;s best t
<table class="manual-example">
<tr><th></th><td class="jqprogram">jq '.[2:4]'</td></tr>
- <tr><th>Input</th><td>["a","b","c","d","e"]</td></tr>
+ <tr><th>Input</th><td>[&quot;a&quot;,&quot;b&quot;,&quot;c&quot;,&quot;d&quot;,&quot;e&quot;]</td></tr>
<tr>
<th>Output</th>
- <td>["c", "d"]</td>
+ <td>[&quot;c&quot;, &quot;d&quot;]</td>
</tr>
@@ -679,14 +852,14 @@ defined</code>. When using the Windows command shell (cmd.exe) it&#8217;s best t
<table class="manual-example">
<tr><th></th><td class="jqprogram">jq '.[2:4]'</td></tr>
- <tr><th>Input</th><td>"abcdefghi"</td></tr>
+ <tr><th>Input</th><td>&quot;abcdefghi&quot;</td></tr>
<tr>
<th>Output</th>
- <td>"cd"</td>
+ <td>&quot;cd&quot;</td>
</tr>
@@ -694,14 +867,14 @@ defined</code>. When using the Windows command shell (cmd.exe) it&#8217;s best t
<table class="manual-example">
<tr><th></th><td class="jqprogram">jq '.[:3]'</td></tr>
- <tr><th>Input</th><td>["a","b","c","d","e"]</td></tr>
+ <tr><th>Input</th><td>[&quot;a&quot;,&quot;b&quot;,&quot;c&quot;,&quot;d&quot;,&quot;e&quot;]</td></tr>
<tr>
<th>Output</th>
- <td>["a", "b", "c"]</td>
+ <td>[&quot;a&quot;, &quot;b&quot;, &quot;c&quot;]</td>
</tr>