summaryrefslogtreecommitdiffstats
path: root/jq.1.prebuilt
diff options
context:
space:
mode:
Diffstat (limited to 'jq.1.prebuilt')
-rw-r--r--jq.1.prebuilt25
1 files changed, 22 insertions, 3 deletions
diff --git a/jq.1.prebuilt b/jq.1.prebuilt
index f09ee6ad..ef04d741 100644
--- a/jq.1.prebuilt
+++ b/jq.1.prebuilt
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "JQ" "1" "February 2017" "" ""
+.TH "JQ" "1" "April 2017" "" ""
.
.SH "NAME"
\fBjq\fR \- Command\-line JSON processor
@@ -445,7 +445,7 @@ jq supports the same set of datatypes as JSON \- numbers, strings, booleans, arr
Booleans, null, strings and numbers are written the same way as in javascript\. Just like everything else in jq, these simple values take an input and produce an output \- \fB42\fR is a valid jq expression that takes an input, ignores it, and returns 42 instead\.
.
.SS "Array construction: []"
-As in JSON, \fB[]\fR is used to construct arrays, as in \fB[1,2,3]\fR\. The elements of the arrays can be any jq expression\. All of the results produced by all of the expressions are collected into one big array\. You can use it to construct an array out of a known quantity of values (as in \fB[\.foo, \.bar, \.baz]\fR) or to "collect" all the results of a filter into an array (as in \fB[\.items[]\.name]\fR)
+As in JSON, \fB[]\fR is used to construct arrays, as in \fB[1,2,3]\fR\. The elements of the arrays can be any jq expression, including a pipeline\. All of the results produced by all of the expressions are collected into one big array\. You can use it to construct an array out of a known quantity of values (as in \fB[\.foo, \.bar, \.baz]\fR) or to "collect" all the results of a filter into an array (as in \fB[\.items[]\.name]\fR)
.
.P
Once you understand the "," operator, you can look at jq\'s array syntax in a different light: the expression \fB[1,2,3]\fR is not using a built\-in syntax for comma\-separated arrays, but is instead applying the \fB[]\fR operator (collect results) to the expression 1,2,3 (which produces three different results)\.
@@ -460,6 +460,10 @@ If you have a filter \fBX\fR that produces four results, then the expression \fB
jq \'[\.user, \.projects[]]\'
{"user":"stedolan", "projects": ["jq", "wikiflow"]}
=> ["stedolan", "jq", "wikiflow"]
+
+jq \'[ \.[] | \. * 2]\'
+ [1, 2, 3]
+=> [2, 4, 6]
.
.fi
.
@@ -469,7 +473,7 @@ jq \'[\.user, \.projects[]]\'
Like JSON, \fB{}\fR is for constructing objects (aka dictionaries or hashes), as in: \fB{"a": 42, "b": 17}\fR\.
.
.P
-If the keys are "identifier\-like", then the quotes can be left off, as in \fB{a:42, b:17}\. Keys generated by expressions need to be parenthesized, e\.g\.,\fR{("a"+"b"):59}`\.
+If the keys are "identifier\-like", then the quotes can be left off, as in \fB{a:42, b:17}\fR\. Keys generated by expressions need to be parenthesized, e\.g\., \fB{("a"+"b"):59}\fR\.
.
.P
The value can be any expression (although you may need to wrap it in parentheses if it\'s a complicated one), which gets applied to the {} expression\'s input (remember, all filters have an input and an output)\.
@@ -2878,6 +2882,21 @@ jq \'reduce \.[] as $n ([]; if $n%2==0 then empty else \. + [$n] end)\'
.
.IP "" 0
.
+.SS "isempty(exp)"
+Returns true if \fBexp\fR produces no outputs, false otherwise\.
+.
+.IP "" 4
+.
+.nf
+
+jq \'isempty(empty)\'
+ null
+=> true
+.
+.fi
+.
+.IP "" 0
+.
.SS "limit(n; exp)"
The \fBlimit\fR function extracts up to \fBn\fR outputs from \fBexp\fR\.
.