jq command-line options and filters from the jq 1.8 manual, grouped by task: invoking jq, reaching into a document, arrays, objects, strings, regular expressions, conditionals, assignment, formats and dates. Options appear without the leading jq, filters without shell quotes; lowercase words such as f or regex stand for your own expression. A program is a chain of filters joined by |, each taking one value and emitting zero or more. C math functions and some rare options are omitted.
Quoting depends on the shell. PowerShell keeps the single quotes but needs each inner double quote written as \"; cmd.exe wants double quotes around the program, again with the inner ones backslash-escaped.
Command
What it does
-n
Run without reading inputLong form --null-input; the filter runs once on null, which suits calculations and building JSON from nothing.
-R
Read input as raw textLong form --raw-input; each line arrives as a string, and with --slurp the whole input becomes one string.
-s
Slurp all inputs into one arrayLong form --slurp; the filter then runs a single time over that array instead of once per JSON value.
--stream
Parse input as a streamTurns the input into [path, leaf] events while it is parsed, so work can begin on very large files immediately.
-f
Load the program from a fileLong form --from-file; the filter argument is then taken as a file name, in the manner of awk -f.
-L directory
Add a module search directoryLong form --library-path directory; it goes to the front of the search list and the built-in list is no longer used.
-e
Exit status from the last outputLong form --exit-status; exits 0 for a last output other than false or null, 1 for those two, 4 for no output.
-b
Keep LF line endings on WindowsLong form --binary; meant for a native jq.exe run from WSL, MSYS2 or Cygwin, where newlines would otherwise become CRLF.
-V
Print the versionLong form --version; jq prints its version and exits with status zero.
jq '.["foo"]'
Quote the program for a Unix shellSingle quotes keep the shell from interpreting characters that jq also uses; PowerShell and cmd.exe need the inner quotes escaped.
Output formatting options 11
Command
What it does
-c
Compact outputLong form --compact-output; prints each JSON value on one line instead of pretty-printing it.
-r
Print strings without quotesLong form --raw-output; a string result is written as plain text, convenient when the next program does not read JSON.
--raw-output0
Raw output ending in NULBehaves as -r but puts a NUL character after each output, for values that may themselves contain newlines.
-j
Raw output with no newlineLong form --join-output; acts as -r does, except that no line break is written between outputs.
-a
Escape non-ASCII charactersLong form --ascii-output; every non-ASCII codepoint is written as an escape sequence, so the result is plain ASCII.
-S
Sort object keysLong form --sort-keys; every object is printed with its fields in sorted key order.
-C
Force colored outputLong form --color-output; colors the JSON even when output is piped or redirected, and overrides NO_COLOR.
-M
Disable colored outputLong form --monochrome-output; without it jq colors its output whenever it writes to a terminal.
--tab
Indent with tabsEach nesting level gets one tab in place of the default two spaces.
--indent n
Set the indentation widthTakes how many spaces to indent by, 7 at most.
--unbuffered
Flush after each outputHelps when a slow source feeds jq and its own output is piped on to another program.
Passing variables and arguments 9
Command
What it does
--arg name value
Pass a string variableThe program can read it as $name; the value is always a string, so 123 arrives as "123".
--argjson name JSON-text
Pass a JSON variableThe text is decoded as JSON first, so --argjson foo 123 binds the number 123 to $foo.
--slurpfile variable-name filename
Load a JSON file into a variableThe variable holds an array with every JSON text parsed from that file.
--rawfile variable-name filename
Load a text file into a variableThe variable holds the file's contents as one unparsed string.
--args
Positional string argumentsEverything after it is kept as a string and reached through $ARGS.positional[].
--jsonargs
Positional JSON argumentsEverything after it is parsed as JSON text rather than kept as a string.
$ARGS.named
Read named argumentsHolds the named arguments; the only route to a name that cannot be written as an identifier.
$ENV
Environment variables objectReflects the environment as it was when the program started.
env
Current environment as an objectRead-only: jq has no builtin for setting an environment variable.
Basic filters 14
Command
What it does
.
IdentityReturns its input unchanged; run alone it pretty-prints JSON, since jq formats all output by default.
.foo
Get a fieldGives the value stored under that key, or null when the object has no such key.
.foo.bar
Get a nested fieldEquivalent to piping .foo into .bar, one name per level.
.foo?
Get a field without errorsStays quiet instead of failing when the input turns out not to be an object.
.["foo"]
Get a field by quoted nameThe general form of .foo, required for keys with special characters or a leading digit.
.[0]
Get an array elementCounting starts at zero, negative numbers count from the end, and an index beyond the input array gives null.
.[2:4]
Slice an array or stringRuns from the first index up to but excluding the second; either may be negative or left out.
.[]
Iterate over valuesEmits every array element, or every value of an object, as a separate result.
.[]?
Iterate without errorsYields nothing rather than an error when the input is neither an array nor an object.
,
Run filters side by sideBoth filters get the same input; the left one's results are emitted first, then the right one's.
|
PipeFeeds each result of the left filter to the right one, which therefore runs once per result.
.[] | .name
Get a field from each elementPrints the name of every object in the input array as a separate output.
..
Recursive descentEmits the input and every value nested inside it, like recurse called with no argument.
.. | .a?
Find a key at any depthOutputs the value of each key named a found anywhere below the input.
Building and converting values 9
Command
What it does
[]
Array constructionGathers every result of the expression between the brackets into a single array.
{}
Object constructionIdentifier-like keys need no quotes, and a value that yields several results gives several objects.
{user, title}
Pick fields into a new objectCopies the named fields; it is short for {user: .user, title: .title}.
type
Get the type nameThe answer is a string such as "number", "array" or "null".
tostring
Convert to a stringA string passes through as it is; any other value is JSON-encoded.
tonumber
Convert to a numberParses numeric strings, passes numbers through and raises an error on anything else.
toboolean
Convert to a booleanAccepts the strings "true" and "false" besides real booleans; any other input is an error.
tojson
Serialize to JSON textDiffers from tostring in that strings are encoded too and so gain quotes.
fromjson
Parse JSON textTurns a string that holds JSON into the value it describes.
Selecting by type 11
Command
What it does
arrays
Keep only arrays
objects
Keep only objects
iterables
Keep arrays and objectsLets a value through when it is either of the two container types.
booleans
Keep only booleans
numbers
Keep only numbersIn the manual's example .[]|numbers leaves just 1 from a mixed array.
normals
Keep only normal numbers
finites
Keep only finite numbers
strings
Keep only strings
nulls
Keep only null
values
Keep non-null valuesDrops null and passes every other input on unchanged.
scalars
Keep non-iterable valuesPasses anything that is not an array or an object.
Arithmetic and math 14
Most C math library functions exist as builtins too. One-input ones such as ceil, round, log or sin take no argument and act on the input; two-input ones such as pow take two arguments and ignore the input.
Command
What it does
+
AdditionSums numbers, concatenates arrays and strings, merges objects; null added to a value leaves it unchanged.
-
SubtractionBetween arrays it takes every occurrence of the right-hand items out of the left one.
*
MultiplicationAlso repeats a string a given number of times and merges two objects recursively.
/
DivisionA zero divisor is an error; a string divided by a string is split on that separator.
%
Modulo
abs
Absolute valueNegates inputs below zero; the manual points to fabs when a floating-point result is wanted.
floor
Floor of a numberThe manual's example turns 3.14159 into 3.
sqrt
Square rootExpects a number; the manual's example gives 3 for an input of 9.
infinite
Positive infinityLike nan it still reports its type as number.
nan
Not-a-number valueProduces a NaN, the value that isnan answers true for.
isinfinite
Test for infinity
isnan
Test for NaN
isfinite
Test for a finite number
isnormal
Test for a normal number
Arrays 22
Command
What it does
length
Length of a valueCounts array elements, object pairs or string codepoints; null gives 0 and a number its absolute value.
map(f)
Apply a filter to each elementAlways returns an array and is defined as [.[] | f].
map(select(. >= 2))
Filter an arrayKeeps the elements for which the condition holds; the output is again an array.
select(boolean_expression)
Keep inputs that matchPasses the input on unchanged when the condition is true and emits nothing otherwise.
.[] | select(.id == "second")
Find objects by a field valueIterates the input array and emits only the objects whose id equals the given string.
add
Add up an arrayNumbers are summed, strings and arrays joined, objects merged; an empty array gives null.
add(generator)
Add up generator outputsWorks on the results of its argument instead of on an input array.
any
True if any element is trueTakes an array of booleans; an empty one gives false.
any(condition)
Any element meets a conditionTests each element of the input array against the condition.
any(generator; condition)
Any output meets a conditionTests what the generator emits rather than the elements of the input.
all
True if all elements are trueTakes an array of booleans; an empty one gives true.
all(condition)
All elements meet a condition
all(generator; condition)
All outputs meet a condition
flatten
Flatten nested arraysReplaces arrays found at any depth by their elements, leaving one flat array.
flatten(depth)
Flatten to a given depthflatten(1) removes a single level of nesting and keeps deeper arrays.
reverse
Reverse an array
first
First element of an arrayTakes the array from the current input; first(expr) is the form for a stream of outputs.
last
Last element of an array
nth(n)
Element at index nReads the array at the current input, unlike nth(n; expr), which counts outputs.
transpose
Transpose an array of arraysShort rows are filled with null so that every row ends up the same length.
combinations
All combinations across arraysGiven an array of arrays, emits each way of taking one element from every array.
combinations(n)
Combinations with repetitionEmits every sequence of n elements drawn from the input array.
Sorting, searching and joining 18
Command
What it does
sort
Sort an arrayOrders by type first: null, false, true, numbers, strings, arrays, then objects.
sort_by(path_expression)
Sort by a field or expressionCompares elements by what the filter returns; several results are compared one after another.
group_by(path_expression)
Group elements by a valueReturns an array of groups, one per distinct result, ordered by that result.
min
Smallest elementThe manual's example returns 2 for the array [5,4,2,7].
max
Largest element
min_by(path_exp)
Element with the smallest valueCompares on the given field or expression, so min_by(.foo) returns the object with the lowest foo.
max_by(path_exp)
Element with the largest valueReturns the whole element, not just the value that was compared.
unique
Sort and remove duplicatesThe result comes back in sorted order rather than in the order of the input.
unique_by(path_exp)
Unique by a field or expressionKeeps a single element for each distinct result of the argument.
contains(element)
Check containmentStrings match as substrings, arrays when each listed element is contained, objects key by key.
inside(b)
Check containment in reverseThe mirror of contains: true when the input is wholly contained in the argument.
indices(s)
Find all positions of a valueWorks on strings and arrays and returns every index where the argument occurs.
index(s)
First position of a valueAccepts a string or an array as input and returns one index, not a list.
rindex(s)
Last position of a value
bsearch(x)
Binary search a sorted arrayGives the index when found, otherwise -1 minus the position where the value would be inserted.
INDEX(stream; index_expression)
Build a lookup objectEach stream value is stored under the key that the expression computes from it.
JOIN($idx; stream; idx_expr; join_expr)
Join a stream to an indexPairs each stream value with its entry in the index and hands the pair to the join expression.
IN(s)
Test membership in a streamTrue when the input equals one of the values that the stream produces.
Objects and paths 16
Command
What it does
keys
List keys in sorted orderGiven an array, it returns the valid indices instead.
keys_unsorted
List keys in original orderSkips the sorting, so keys appear roughly as they were inserted.
has(key)
Test for a key or indexQuicker than looking for the key in the output of keys.
in
Test a key against an objectThe reverse of has: the input is the key or index, the argument the object or array.
map_values(f)
Apply a filter to each valueKeeps an object's keys and drops any key whose value yields no result.
to_entries
Object to key-value pairsEach pair becomes an object with a key field and a value field.
from_entries
Key-value pairs to objectAlso reads name or Name in place of key, and capitalised Key and Value.
with_entries(f)
Transform keys and valuesConverts to entries, runs the filter on each one, then builds the object again.
del(path_expression)
Delete a key or elementTakes any path expression, so del(.[1, 2]) removes two array elements at once.
pick(pathexps)
Keep only selected pathsBuilds a copy holding just the listed paths; one that is missing from the input comes out as null.
path(path_expression)
Get paths as arraysEach path is an array of object keys and array indices that leads to a value.
paths
List all pathsLeaves out the empty path, the one that stands for the input itself.
paths(node_filter)
Paths to matching valuesLists only paths whose value passes the filter, for example every number.
getpath(PATHS)
Read the value at a pathA path that does not exist returns null instead of an error.
setpath(PATHS; VALUE)
Set the value at a pathObjects and arrays missing along the way are created as needed.
delpaths(PATHS)
Delete several pathsExpects an array of paths, each one an array of keys and indices.
Strings 16
Command
What it does
\(exp)
String interpolationWritten inside a string literal; the result of the expression is inserted at that spot.
utf8bytelength
Byte length in UTF-8Counts encoded bytes, whereas length counts codepoints.
startswith(str)
Check the start of a string
endswith(str)
Check the end of a string
ltrimstr(str)
Remove a prefixReturns the input unchanged when it does not begin with that string.
rtrimstr(str)
Remove a suffixReturns the input unchanged when it does not finish with that string.
trimstr(str)
Remove a string at both endsDoes nothing when the input neither starts nor ends with that string.
trim
Trim whitespace at both endsWhitespace also covers any character with the Unicode whitespace property.
ltrim
Trim leading whitespace
rtrim
Trim trailing whitespace
explode
String to codepoint numbersGives an array with one number per character of the input.
implode
Codepoint numbers to stringTurns an array of codepoint numbers back into text, undoing explode.
split(str)
Split on a separatorWith one argument the separator is a literal string, not a regex.
join(str)
Join with a separatorNumbers and booleans become strings and null counts as an empty string.
ascii_downcase
Lowercase ASCII letters
ascii_upcase
Uppercase ASCII lettersOnly the letters a-z are changed, so a character such as é stays as it is.
Regular expressions 15
Flags are single letters given together in one string: g all matches, i ignore case, x extended syntax, n skip empty matches, s single-line mode, l longest match. A regex is a JSON string, so a backslash is doubled: \s is typed "\\s".
Command
What it does
test(val)
Test for a regex matchAnswers with true or false only, never with match objects.
test(regex; flags)
Test with regex flagsFlags are letters in a string, such as i for case-insensitive or x for extended syntax.
match(val)
Get match detailsEmits one object per match holding its offset, length, string and captures.
match(regex; flags)
Match with flagsThe g flag reports all matches where the default stops after the first.
capture(val)
Named captures as an objectEvery named group becomes a key whose value is the text it matched.
capture(regex; flags)
Named captures with flags
scan(regex)
List all matching substringsEmits matches as a stream; a regex with groups yields arrays of the captured strings instead.
scan(regex; flags)
Scan with flags
split(regex; flags)
Split on a regexOnly the two-argument form uses a regex; pass null when no flags are needed.
splits(regex)
Split on a regex into a streamEmits the pieces one at a time instead of returning one array.
splits(regex; flags)
Stream split with flags
sub(regex; tostring)
Replace the first matchThe replacement string can refer to a named capture, for example "\(.x)".
sub(regex; tostring; flags)
Replace with flagsWith the g flag every match is replaced, as the manual's own example does.
gsub(regex; tostring)
Replace every matchActs as sub does, but on all occurrences that do not overlap.
gsub(regex; tostring; flags)
Replace all with flags
Conditionals and error handling 19
Command
What it does
==
EqualStrict, like === in JavaScript: a string never equals a number, and key order does not matter.
!=
Not equalGives the opposite answer to == for the same two values.
>
Greater than
>=
Greater than or equal
<=
Less than or equal
<
Less thanValues of different types are ordered the way sort orders them.
and
Boolean andOnly false and null count as false; every other value counts as true.
or
Boolean orYields only true or false; to choose between two values use // instead.
not
Boolean negationA builtin function, not an operator, so a value is piped into it.
if A then B else C end
ConditionalEvaluates B when A is anything but false or null, and C otherwise.
//
Alternative operatorFalls back to the right side when the left yields nothing except false or null.
.foo // 42
Default for a missing fieldOutputs the field when it has a real value and 42 when it is absent, null or false.
try EXP catch EXP
Catch errorsWhen the first expression fails, the second runs with the error message as its input.
?
Suppress errorsWritten after an expression, as in EXP?, it is short for try EXP.
error
Raise an errorThe input value itself becomes the error, which try/catch can pick up.
error(message)
Raise an error with a messageThe argument becomes the error value that a catch body receives.
halt
Stop the programEnds jq immediately with exit status 0 and nothing more is output.
halt_error
Stop with an error messageWrites the input to stderr, strings unquoted, and exits with status 5.
halt_error(exit_code)
Stop with a chosen exit statusThe argument replaces the default exit status of 5.
Variables and reduction 5
Command
What it does
... as $identifier | ...
Bind a variableThe rest of the pipeline runs once for each value of the expression, with the variable set to it.
?//
Destructuring alternativeTries each pattern in turn, for input that may arrive in more than one shape.
reduce EXP as $var (INIT; UPDATE)
Fold results into one valueStarts from INIT and runs UPDATE once per result of EXP, with the running value as the dot.
foreach EXP as $var (INIT; UPDATE; EXTRACT)
Fold and emit each stepWorks like reduce but outputs every intermediate value; EXTRACT may be omitted.
def increment: .+1;
Define a functionFrom then on the name can be used as a filter, exactly like a builtin.
Generators and loops 17
Command
What it does
empty
Produce no outputEmits zero results; in [1,2,empty,3] it just disappears from the array.
isempty(exp)
Test for no outputsTrue when the expression yields nothing, for instance .[] on an empty array.
range(upto)
Numbers from 0 up to a limitCounts from 0 in steps of 1 and stops before the given number.
range(from; upto)
Numbers between two boundsThe start is included, the end is not, and each number is a separate output.
range(from; upto; by)
Numbers with a stepThe third argument is the increment; a negative one counts downwards.
limit(n; expr)
Take the first n outputsYields fewer when the expression has fewer than n results to give.
skip(n; expr)
Skip the first n outputs
first(expr)
First output of an expressionGives no output at all when the expression itself gives none.
last(expr)
Last output of an expression
nth(n; expr)
Nth output of an expressionCounts from zero and does not accept a negative n.
while(cond; update)
Repeat while a condition holdsEmits the input and each updated value for as long as the condition stays true.
repeat(exp)
Repeat until an errorKeeps feeding the expression its own results; only a raised error ends the loop.
until(cond; next)
Repeat until a condition holdsApplies next to its own result again and again and stops once the condition is true.
recurse(f)
Recurse with a filterEmits the input, then keeps applying f to each result, which walks a nested structure.
recurse
Recurse through all valuesWith no argument it equals recurse(.[]?) and visits every nested value.
recurse(f; condition)
Recurse while a condition holdsStops descending a branch as soon as a value fails the condition.
walk(f)
Transform every nested valueWorks bottom-up: the parts of an array or object are processed before the container itself.
Assignment and updates 8
Command
What it does
=
Plain assignmentThe right side sees the whole input, and each value it yields gives a separate output.
|=
Update assignmentRuns the old value through the filter; a filter that yields nothing deletes the path.
+=
Add and assignEquivalent to a |= . + b, so .foo += 1 increments a field.
-=
Subtract and assign
*=
Multiply and assign
/=
Divide and assign
%=
Modulo and assign
//=
Assign a defaultApplies the // operator to the current value, so only false or null gets replaced.
Formats and escaping 9
Command
What it does
@csv
Format a row as CSVNeeds an array as input; strings get double quotes, and a quote inside is doubled.
@tsv
Format a row as TSVNeeds an array; tabs, newlines, carriage returns and backslashes in a field are written as escapes.
@json
Serialize as JSON
@html
Escape for HTML or XMLTurns the angle brackets, the ampersand and both quote characters into entities.
@uri
Percent-encode for a URLEvery reserved URI character is replaced by a %XX sequence.
@urid
Decode percent-encodingUndoes @uri by turning each %XX sequence back into its character.
@sh
Quote for a POSIX shellAn array input comes out as a series of quoted strings separated by spaces.
@base64
Encode as base64Encodes the input according to RFC 4648.
@base64d
Decode base64The result is undefined when the decoded bytes are not valid UTF-8.
Dates and times 7
The date builtins work in UTC only. The manual warns that some systems lack part of this functionality; on macOS, strptime does not support the %u and %j specifiers.
Command
What it does
now
Current timeA number of seconds counted from the Unix epoch.
todate
Seconds to an ISO 8601 stringAnother name for todateiso8601, the inverse of fromdateiso8601.
fromdate
Date string to secondsOnly ISO 8601 strings are accepted at present.
strptime(fmt)
Parse a date with a formatOutputs broken-down time, the array form that mktime accepts.
strftime(fmt)
Format a time as textRenders the time in GMT; strflocaltime does the same in the local time zone.
mktime
Broken-down time to secondsTakes the arrays that gmtime and strptime produce.
gmtime
Seconds to broken-down UTC timeThe array lists year, zero-based month, day, hour, minute, second, weekday and day of the year.
Input and output 11
Command
What it does
input
Read the next inputNormally used with -n; otherwise the first value is consumed before the program can ask for it.
inputs
Read all remaining inputsEmits them one after another, which suits a reduction over the whole input stream.
Sum every input valueBecause of -n nothing is read implicitly, so the reduction sees all three numbers and prints 6.
debug
Print a debug messagePasses its input through and writes a ["DEBUG:",value] line to stderr.
debug(msgs)
Debug with a custom messageLogs each result of the argument while the input itself passes through untouched.
stderr
Write the input to stderrThe text is raw and compact, and no newline is added.
input_filename
Name of the current input fileMay not work well unless jq runs in a UTF-8 locale.
input_line_number
Line number of the current input
tostream
Convert to streamed formEmits the same [path, leaf] events that reading with --stream would give.
fromstream(stream_expression)
Rebuild values from a streamTurns streamed path and leaf events back into complete values.
truncate_stream(stream_expression)
Strip leading path elementsThe numeric input says how many elements to drop from the left of each path.
Modules and build information 9
Command
What it does
import RelativePathString as NAME [<METADATA>];
Import a moduleLoads a .jq file found on the search path; its functions are then called with a NAME:: prefix.
include RelativePathString [<METADATA>];
Include a module in placeThe module's definitions land in the caller's namespace, as if written there.
module <METADATA>;
Declare module metadataOptional; its only purpose is to supply metadata that modulemeta can read.
modulemeta
Read a module's metadataTakes a module name and returns its metadata, with imports under deps and functions under defs.
builtins
List all builtin functionsEntries read name/arity, which is why all is listed three times, once per arity.
have_literal_numbers
Check number literal supportTrue when this build keeps number literals exactly as they were written in the input.
have_decnum
Check for the decnum backendReports whether decnum, the backend that keeps number literals exact, is compiled in.
$JQ_BUILD_CONFIGURATION
Build configuration stringContains at least the ./configure arguments, and --arg can override it.
$__loc__
File and line of the programAn object with file and line keys telling where the token itself is written.
No row on this page matches that filter.
Notes
Reaching into a document
. on its own pretty-prints the input, which is the most common invocation of all. .foo reads a key and .foo.bar a nested one; .[] iterates an array or an object's values, producing a stream, and .[]? does the same without erroring on non-iterables. Filters are chained with |, so .items[] | .name lists every item's name. .. recurses through every value at any depth, which combined with a filter finds a key wherever it hides. keys and length answer "what is in here" for an unfamiliar document.
Reshaping
map(f) applies a filter to each array element and collects the results; [] and {} build arrays and objects from a stream, so [.[] | .id] collects IDs and {name, id} picks two fields. del(path_expression) removes keys, has(key) tests for one, and // supplies a default when a value is null, false or missing. if A then B else C end branches, and |= updates in place: .price |= . * 1.1 changes a field without rebuilding the object.
Text, aggregation and multiple inputs
test(val) matches a regex and gsub(regex; tostring) replaces every match; both have a form with one more argument for flags such as "i". reduce EXP as $var (INIT; UPDATE) folds a stream into one value — reduce .[] as $x (0; . + $x.amount) sums a field — and ... as $identifier | ... binds a value to a variable for reuse later in the pipeline. limit(n; expr) and first(expr) take the first results of a stream. inputs reads all remaining input documents, which with -n lets one program aggregate across many files or a newline-delimited log. try EXP catch EXP turns an error into a value instead of aborting the run.
Questions
How do I get a raw string without quotes?
Add -r (long form --raw-output) to the command line: a string result is then printed without JSON quoting, which scripts usually want. -j does the same and also leaves out the newline after each output.
How do I select array items that match a condition?
Use select inside an iteration, as in .[] | select(.id == "second"). To get the matches back as an array, write it as map(select(. >= 2)) or wrap the pipeline in [ ].
How do I combine several JSON files?
-s reads every input document into one array and runs the filter once on it. The other way is to run with -n and collect inputs inside [ ], which builds the same array in the program itself.
Why does .foo fail with "Cannot index"?
The input at that point is not an object — often an array. Iterate first with .[] or index a position with .[0]; .foo? hides the error instead of fixing it.
Sources and checks
jq 1.8 Manual (jqlang.org)Command-line options, filters, builtin functions and the examples printed in the manual
Every row on this page was matched to a line in the documentation above on . A binding that could not be found there is not listed.
2 rows from the earlier version of this page were removed in that check: duplicates, and bindings the documentation does not list or lists differently.
Found a wrong or missing key? Tell us and it gets checked against the source. How we verify describes the process and its limits.