jq Cheat Sheet
A complete quick-reference for jq — the command-line JSON processor. Search by keyword or filter by category to find the exact operator, builtin, or flag you need.
🔧 About jq
jq is a lightweight, flexible command-line JSON processor created by Stephen Dolan in 2012. Think of it as sed/awk for JSON — a small functional language for slicing, filtering, mapping, and reshaping structured data in shell pipelines. It is the de-facto standard tool for working with JSON in scripts, CI, and one-off ops tasks.
Key Characteristics
- Stream-based: Filters emit 0, 1, or many values
- Composable: Pipes (
|) chain filters together - Single binary: No runtime or dependencies
- Tiny syntax: A page of operators covers most needs
- Battle-tested: Stable since 2012, ubiquitous in DevOps
- MIT licensed: Free for any use
Common Use Cases
- Extract fields from REST / GraphQL responses
- Filter logs and Kubernetes manifests
- Reshape JSON for CSV / TSV import
- Build CI pipelines that read structured output
- Diff & sort JSON for review
- Generate JSON test fixtures on the fly
Mental Model
Every jq filter takes one JSON value as input and emits a stream of zero
or more JSON values as output. . is the
identity filter. .foo projects a field. .[] iterates. The pipe | feeds the output of one filter into the
next. Almost everything in jq is built from those four ideas.
.
BasicsIdentity filter — emits the input unchanged. Often used to pretty-print JSON.
Syntax:
jq .Examples:
echo '{"a":1,"b":2}' | jq . Pretty-print JSONcurl -s https://api.example.com/data | jq . Format an API responseNotes:
jq pretty-prints by default. Use -c (compact) to keep it on one line.
.foo
BasicsObject field access — emits the value of key "foo".
Syntax:
jq '.field'Examples:
echo '{"name":"Ada"}' | jq '.name' Get a top-level fieldjq '.user.address.city' data.json Chain field accessesNotes:
Field names that aren't valid identifiers need quoting: .["weird-key"].
.foo?
BasicsOptional access — yields nothing instead of erroring when input is not an object.
Syntax:
jq '.field?'Examples:
echo '[1,2,3]' | jq '.foo?' No error on type mismatchjq '.. | .price?' Walk anywhere, collect prices, ignore non-objectsNotes:
Use ? whenever a filter may encounter mixed types.
.[n]
BasicsArray index — negative indices count from the end.
Syntax:
jq '.[INDEX]'Examples:
echo '[10,20,30]' | jq '.[0]' First element → 10jq '.[-1]' items.json Last element.[a:b]
BasicsArray / string slice — half-open range [a, b).
Syntax:
jq '.[START:END]'Examples:
echo '[1,2,3,4,5]' | jq '.[1:3]' Returns [2,3]echo '"hello"' | jq '.[1:4]' Returns "ell"Notes:
Either bound may be omitted: .[:3] or .[2:].
.[]
BasicsIterate — emits each array element or object value as a separate output.
Syntax:
jq '.[]'Examples:
jq '.users[]' data.json Stream each user objectjq '.users[] | .email' Pipe each user into another filterNotes:
Wrap in [...] to collect the stream back into an array.
..
BasicsRecursive descent — every value at every depth, in DFS order.
Syntax:
jq '..'Examples:
jq '.. | numbers' data.json Every number anywhere in the docjq '.. | .id? | select(. != null)' Every id field, ignoring misses|
Pipes & CompositionPipe — feed output of one filter as input to the next.
Syntax:
F1 | F2Examples:
jq '.users[] | .name' Iterate users, project the namejq '.orders | length' data.json Count orders,
Pipes & CompositionComma — emit the outputs of each filter, in order.
Syntax:
F1, F2Examples:
jq '.name, .email' user.json Emit both fields, two valuesjq '.first, .last' names.json Stream two fields per object( ... )
Pipes & CompositionGroup filters — parentheses override default precedence.
Syntax:
(F1, F2) | F3Examples:
jq '(.a, .b) | tostring' Stringify both a and bjq '(.x // 0) + 1' Increment x with default 0//
Pipes & CompositionAlternative — return left side if defined and non-null, else right side.
Syntax:
EXPR // DEFAULTExamples:
jq '.name // "anonymous"' user.json Provide a default valuejq '.config.port // 8080' Default port for missing config|=
Pipes & CompositionUpdate-assignment — apply a filter to the value at a path.
Syntax:
PATH |= EXPRExamples:
jq '.price |= . * 1.1' product.json Raise price by 10%jq '.tags |= map(ascii_downcase)' Lowercase every tagNotes:
Related: = (set), += (add), -= (subtract), //= (default-if-null).
select(f)
FilteringPass-through if f is truthy — discard otherwise.
Syntax:
select(CONDITION)Examples:
jq '.[] | select(.price < 20)' Items cheaper than 20jq '.[] | select(.tags | contains(["sale"]))' Items with the "sale" tagif-then-elif-else-end
FilteringConditional — emit different filters based on a predicate.
Syntax:
if COND then A elif COND2 then B else C endExamples:
jq 'if .age < 18 then "minor" else "adult" end' Map ages to a labeljq 'if .status == "ok" then .data else error("bad") end' Branch on statusNotes:
else is optional — without it, the input is passed through unchanged.
has(k)
FilteringTrue if input has key k (object) or index k (array).
Syntax:
has(KEY)Examples:
jq '.[] | select(has("email"))' Keep items that have an email fieldjq 'has(2)' '[1,2,3]' True — index 2 existscontains(v)
FilteringRecursive containment — true if input contains v structurally.
Syntax:
contains(VALUE)Examples:
jq '. | contains({user: {name: "Ada"}})' Nested object matchjq '.tags | contains(["sale"])' Array contains the substringNotes:
Strings: substring match. Arrays: every element of b matches some element of a.
in(o)
FilteringTrue if input is a key in object o (or an index in array o).
Syntax:
in(OBJECT)Examples:
jq '"name" | in({name: 1, age: 2})' True — "name" is a keyjq '.[] | select(.id | in($whitelist))' Filter by allowed idsnot
FilteringLogical negation — postfix, applied via pipe.
Syntax:
EXPR | notExamples:
jq '.[] | select(.archived | not)' Only un-archived rowsjq 'false | not' Returns truearrays, objects, strings, numbers, booleans, nulls, iterables, scalars
FilteringType-picker filters — pass the input only if it has the matching type.
Syntax:
arrays | objects | strings | ...Examples:
jq '.. | strings' Every string anywhere in the docjq '.. | objects | select(.id?)' Objects that have an idlength
Array & Object OperationsLength of array, string, or object; absolute value of a number; 0 for null.
Syntax:
lengthExamples:
jq '.items | length' Count of itemsjq '.name | length' user.json Length of a stringkeys / keys_unsorted
Array & Object OperationsSorted keys of an object (or 0..n-1 for arrays). keys_unsorted preserves order.
Syntax:
keysExamples:
jq '.user | keys' List the user object's fieldsjq 'keys_unsorted' map.json Keep insertion ordervalues
Array & Object OperationsArray of values from an object (or the array itself).
Syntax:
valuesExamples:
jq '.counts | values | add' Sum every value in the objectjq '.users | values | length' Count entriesmap(f)
Array & Object OperationsApply f to every element of an input array — shorthand for [.[] | f].
Syntax:
map(EXPR)Examples:
jq '.prices | map(. * 1.2)' Raise every price by 20%jq '.users | map(.email)' Extract all emailsmap_values(f)
Array & Object OperationsApply f to every value of an object (or array element) — keeps keys.
Syntax:
map_values(EXPR)Examples:
jq '.counts | map_values(. + 1)' Increment every valuejq '.users | map_values(.name)' Replace each user with their nameto_entries
Array & Object OperationsConvert {k: v} → [{key: k, value: v}, ...] — enables iterating with keys.
Syntax:
to_entriesExamples:
jq '. | to_entries' '{"a":1,"b":2}' Yields [{key:"a",value:1},...]jq 'to_entries | map(.key)' Same as `keys_unsorted`from_entries
Array & Object OperationsInverse of to_entries — array of {key, value} → object.
Syntax:
from_entriesExamples:
jq '[{key:"a",value:1},{key:"b",value:2}] | from_entries' Yields {a:1,b:2}jq 'to_entries | map(select(.value > 0)) | from_entries' Drop zero-valued keyswith_entries(f)
Array & Object OperationsShorthand for to_entries | map(f) | from_entries — rewrite an object.
Syntax:
with_entries(EXPR)Examples:
jq 'with_entries(.key |= ascii_downcase)' Lowercase every keyjq 'with_entries(select(.value != null))' Drop null fields{ k: v, ... }
Array & Object OperationsObject construction — { name, age } uses .name as both key and value.
Syntax:
{ field, key: EXPR, "literal-key": EXPR }Examples:
jq '{name, email}' Project two fieldsjq '{id, total: (.qty * .price)}' Compute a derived field[ ... ]
Array & Object OperationsArray construction — collect a filter's outputs into an array.
Syntax:
[ EXPR ]Examples:
jq '[.users[].name]' All names as one arrayjq '[range(5)]' Build [0,1,2,3,4]sort, sort_by(f)
Sorting & AggregationSort an array. sort_by uses f as the comparison key.
Syntax:
sort | sort_by(EXPR)Examples:
jq '[3,1,4,1,5] | sort' Yields [1,1,3,4,5]jq '.books | sort_by(.price)' Cheapest firstjq '.books | sort_by(-.rating)' Descending by ratinggroup_by(f)
Sorting & AggregationGroup consecutive equal-key items — input is sorted by f first.
Syntax:
group_by(EXPR)Examples:
jq '.orders | group_by(.status)' Group orders by statusjq '.events | group_by(.day) | map({day: .[0].day, count: length})' Count events per dayunique, unique_by(f)
Sorting & AggregationSort + dedupe an array. unique_by uses f as the key.
Syntax:
unique | unique_by(EXPR)Examples:
jq '[1,2,2,3,3,3] | unique' Yields [1,2,3]jq '.users | unique_by(.email)' Dedupe by emailmin, max, min_by(f), max_by(f)
Sorting & AggregationSmallest/largest element of an array; min_by/max_by use f as the key.
Syntax:
min | max | min_by(EXPR) | max_by(EXPR)Examples:
jq '[5,1,9,3] | max' Returns 9jq '.products | max_by(.price)' Most expensive productadd
Sorting & AggregationAdd all elements of an array — numbers sum, strings/arrays concatenate, objects merge.
Syntax:
addExamples:
jq '[.orders[].qty] | add' Total quantity across ordersjq '[{a:1},{b:2}] | add' Yields {"a":1,"b":2} — object mergejq '["foo","bar"] | add' Yields "foobar"any, all, any(f), all(f)
Sorting & AggregationBoolean reductions over an array — short-circuit semantics.
Syntax:
any | all | any(EXPR) | all(EXPR)Examples:
jq '.users | all(.active)' All users currently active?jq '.orders | any(.status == "failed")' Any failed order?first, last, nth(n; f)
Sorting & AggregationExtract first / last / nth element of an array or filter output.
Syntax:
first | last | nth(N; EXPR)Examples:
jq '.results | first' First resultjq 'nth(2; .users[])' Third user from the streamreverse
Sorting & AggregationReverse the order of an array or string.
Syntax:
reverseExamples:
jq '[1,2,3] | reverse' Yields [3,2,1]jq '.events | sort_by(.ts) | reverse' Newest firstrange(n) / range(a; b) / range(a; b; step)
Sorting & AggregationGenerate an integer stream.
Syntax:
range(N) | range(A; B) | range(A; B; STEP)Examples:
jq -n '[range(5)]' Yields [0,1,2,3,4]jq -n '[range(0; 10; 2)]' Yields [0,2,4,6,8]Notes:
Combine with -n (null input) when generating data.
"\( ... )"
Strings & RegexString interpolation — embed any jq expression inside a string literal.
Syntax:
"prefix \(EXPR) suffix"Examples:
jq '"Hello, \(.name)!"' user.json Greeting from fieldjq '"User #\(.id): \(.email)"' Compose a log linesplit(s), join(s)
Strings & RegexSplit string on separator → array. Join array → string.
Syntax:
split(SEP) | join(SEP)Examples:
jq '"a,b,c" | split(",")' Yields ["a","b","c"]jq '.tags | join(", ")' CSV-style tag stringascii_downcase, ascii_upcase
Strings & RegexLower-case / upper-case an ASCII string.
Syntax:
ascii_downcase | ascii_upcaseExamples:
jq '.email | ascii_downcase' Normalize an emailjq '.code | ascii_upcase' Country code in upper caseltrimstr(s), rtrimstr(s)
Strings & RegexStrip a fixed prefix / suffix if present.
Syntax:
ltrimstr(S) | rtrimstr(S)Examples:
jq '.url | ltrimstr("https://")' Drop the schemejq '.file | rtrimstr(".json")' Drop a known extensionstartswith(s), endswith(s)
Strings & RegexPrefix / suffix predicates.
Syntax:
startswith(S) | endswith(S)Examples:
jq '.[] | select(.name | startswith("test_"))' Keep test entriesjq '.files | map(select(endswith(".log")))' Filter for log filestest(re), match(re)
Strings & RegexRegex predicates. test → bool, match → capture object.
Syntax:
test(PATTERN) | match(PATTERN)Examples:
jq '.[] | select(.email | test("@gmail\\.com$"))' Gmail addressesjq '.title | match("(\\d+)")' First number in the title with offset/lengthNotes:
jq uses Oniguruma regex (PCRE-like). Escape backslashes for the shell.
sub(re; s), gsub(re; s)
Strings & RegexReplace first / all regex matches.
Syntax:
sub(PATTERN; REPLACEMENT) | gsub(PATTERN; REPLACEMENT)Examples:
jq '.msg | gsub("\\s+"; "_")' Whitespace to underscoresjq '.path | sub("^/api/"; "/v2/")' Rewrite a prefixtostring, tonumber
Strings & RegexConvert between string and number representations.
Syntax:
tostring | tonumberExamples:
jq '.[] | .id | tostring' Stringify ids for keysjq '"42" | tonumber' Parse number from string@csv, @tsv
Format StringsFormat an array of scalars as a CSV / TSV row.
Syntax:
[F1, F2, ...] | @csvExamples:
jq -r '[.id, .name, .price] | @csv' Build a CSV rowjq -r '.users[] | [.id, .email] | @tsv' Stream users as TSV — use -r for raw outputNotes:
Always combine format strings with -r so quotes are not re-escaped.
@json
Format StringsRe-encode the input value as a JSON string literal.
Syntax:
. | @jsonExamples:
jq '@json' '{"a":1}' Yields the string "{\"a\":1}"jq -r '.items[] | @json' One JSON document per line (NDJSON)@uri
Format StringsURI-encode the input — safe for use in URLs.
Syntax:
. | @uriExamples:
jq -r '"https://example.com/?q=\(.query | @uri)"' Build a safe query URL@base64, @base64d
Format StringsBase64 encode / decode the input string.
Syntax:
. | @base64 | @base64dExamples:
jq -r '.token | @base64' Base64-encode a valuejq -r '.encoded | @base64d' Decode a base64 string@sh
Format StringsShell-quote a value (or array of values) for safe interpolation in a shell command.
Syntax:
. | @shExamples:
jq -r '.files | @sh' | xargs rm Safely delete a list of filesNotes:
Single-quotes everything — even values containing spaces or quotes.
+ - * / %
MathArithmetic on numbers — also: + concatenates arrays/strings/objects.
Syntax:
A + B | A - B | A * B | A / B | A % BExamples:
jq '.price * 1.1' Raise price 10%jq '.a + .b' '{"a":[1],"b":[2]}' Concat arrays → [1,2]jq '.first + " " + .last' Concat stringsfloor, ceil, round, fabs/abs, sqrt
MathStandard math functions on numbers.
Syntax:
floor | ceil | round | fabs | sqrtExamples:
jq '3.7 | floor' Returns 3jq '.amount | round' Round to nearest integer== != < <= > >=
MathEquality and ordered comparisons — work on any JSON value (jq compares structurally).
Syntax:
A == B | A < B | A >= BExamples:
jq '.[] | select(.price < 50)' Filter by numberjq '.[] | select(.tags == ["sale","new"])' Array-equality checkpaths, paths(f), leaf_paths
Paths & RecursionEmit every path (array of keys/indices) in the document. leaf_paths skips containers.
Syntax:
paths | paths(EXPR) | leaf_pathsExamples:
jq '[paths]' List every path in the docjq '[paths(type == "number")]' Paths to every numeric valuegetpath(p)
Paths & RecursionRead the value at path p (where p is an array like ["a", 0, "b"]).
Syntax:
getpath(PATH)Examples:
jq 'getpath(["user","name"])' Same as .user.namejq 'paths as $p | getpath($p) | numbers' All numbers, via pathssetpath(p; v)
Paths & RecursionSet the value at path p — useful with calculated paths.
Syntax:
setpath(PATH; VALUE)Examples:
jq 'setpath(["user","email"]; "x@y.com")' Overwrite a nested fieldrecurse, recurse(f)
Paths & RecursionApply f repeatedly, emitting each output (default: walk children).
Syntax:
recurse | recurse(EXPR)Examples:
jq 'recurse' Every node, depth-firstjq 'recurse(.children[]?) | .name' Walk a tree of children, emit nameswalk(f)
Paths & RecursionBottom-up traversal — apply f to every value after its children are visited.
Syntax:
walk(EXPR)Examples:
jq 'walk(if type == "string" then ascii_downcase else . end)' Lowercase every string anywhere in the docas $name | ...
Variables & ErrorsBind the output of a filter to a variable, then continue.
Syntax:
EXPR as $NAME | BODYExamples:
jq '.users[] as $u | $u.email' Iterate users, bind eachjq '. as $root | .items[] | {name, root: $root.name}' Keep a reference to the outer objecttry / catch
Variables & ErrorsRun a filter; swallow or transform errors.
Syntax:
try EXPR catch HANDLERExamples:
jq 'try .a.b.c catch "missing"' Default value on errorjq 'try (.items | length) catch 0' Count, or 0 on errorerror(msg)
Variables & ErrorsRaise an error — terminate the current filter unless caught.
Syntax:
error("MESSAGE")Examples:
jq 'if .status == "ok" then .data else error("bad status: \(.status)") end' Fail noisily on bad datareduce EXPR as $x (INIT; UPDATE)
Variables & ErrorsFold over a stream — like reduce/fold in other languages.
Syntax:
reduce EXPR as $x (INIT; UPDATE)Examples:
jq 'reduce .[] as $x (0; . + $x)' '[1,2,3,4]' Sum (returns 10) — same as addjq 'reduce .users[] as $u ({}; .[$u.email] = $u)' Index users by emailforeach EXPR as $x (INIT; UPDATE; EXTRACT)
Variables & ErrorsLike reduce, but emits the EXTRACT result on every iteration.
Syntax:
foreach EXPR as $x (INIT; UPDATE; EXTRACT)Examples:
jq 'foreach .[] as $x (0; . + $x; .)' '[1,2,3]' Running sum: 1, 3, 6def name(args): body;
Variables & ErrorsDefine a reusable user function inside a jq program.
Syntax:
def NAME($p1; $p2): BODY;Examples:
jq 'def double(x): x * 2; .price | double(.)' Define and use a helpertojson, fromjson
Misc & I/OSerialize value to a JSON string / parse a JSON string back into a value.
Syntax:
tojson | fromjsonExamples:
jq '.config | tojson' Stash a value as a stringjq '.encoded | fromjson | .data' Parse JSON inside a string field$ENV / env
Misc & I/OAccess shell environment variables from inside a jq filter.
Syntax:
$ENV.NAME | env.NAMEExamples:
jq -n '{user: $ENV.USER}' Inject env var into JSONinput, inputs
Misc & I/OConsume the next input(s) from the stream — useful with -n.
Syntax:
input | inputsExamples:
jq -n '[inputs] | length' a.json b.json Count how many top-level JSON valuesempty
Misc & I/OEmit no values — useful inside conditionals to drop an output.
Syntax:
emptyExamples:
jq '.[] | if .ok then . else empty end' Drop rows where .ok is false-r (raw output)
CLI FlagsPrint string outputs without JSON quotes — needed for shell piping.
Syntax:
jq -r FILTERExamples:
jq -r '.users[].email' data.json One email per line, unquotedjq -r '.files[]' | xargs ls -l Pipe filenames into another tool-c (compact output)
CLI FlagsPrint each JSON value on a single line — ideal for NDJSON / JSONL.
Syntax:
jq -c FILTERExamples:
jq -c '.[]' big.json > stream.ndjson Convert array → NDJSON file-s (slurp)
CLI FlagsRead all inputs into a single array before applying the filter.
Syntax:
jq -s FILTERExamples:
jq -s 'add' a.json b.json Merge multiple JSON arraysjq -s 'length' stream.ndjson Count lines in an NDJSON file-n (null input)
CLI FlagsDon't read input — start with null. Used with generators like range or env.
Syntax:
jq -n FILTERExamples:
jq -n '[range(5)]' Generate [0,1,2,3,4] from nothingjq -n '$ENV.HOME' Echo an env var as JSON--arg / --argjson
CLI FlagsBind a string ( --arg ) or JSON ( --argjson ) value to a variable in your filter.
Syntax:
--arg NAME VALUE | --argjson NAME JSONExamples:
jq --arg q "ada" '.users[] | select(.name == $q)' Pass shell variable into jqjq --argjson ids '[1,2,3]' '.[] | select(.id | IN($ids[]))' Pass a JSON array as a filter-S (sort keys)
CLI FlagsSort object keys alphabetically in the output — produces canonical JSON.
Syntax:
jq -S FILTERExamples:
jq -S . data.json Pretty-print with sorted keys (diff-friendly)--slurpfile / --rawfile
CLI FlagsRead a JSON file (or raw text file) into a variable for use in the filter.
Syntax:
--slurpfile NAME FILE | --rawfile NAME FILEExamples:
jq --slurpfile cfg config.json '. + $cfg[0]' data.json Merge an external configjq --rawfile readme README.md '{readme: $readme}' Embed a text file as a JSON stringHow to Use the jq Cheat Sheet
- Use the search box above to find an operator, builtin, or flag by name (e.g.
select,group_by,-r). Searches match the command, description, syntax, and every example. - Use the category chips to narrow down by area — Basics, Filtering, Sorting & Aggregation, Strings & Regex, Paths & Recursion, CLI Flags, and more.
- Each card shows the syntax skeleton and one or more runnable examples with a short description of what each one does.
- Copy any example, paste it into your terminal (with real input), and tweak. Pair this page with the jq Query Tester to iterate filters live in the browser before deploying them.
- Read the Notes section under each card for gotchas — escaping, shell interpolation, and feature flags.
Common Use Cases
API Response Inspection
- Pretty-print:
curl ... | jq . - Extract a single field:
jq -r '.token' - Stream items:
jq '.items[]'
Filtering & Reshaping
- Drop rows:
map(select(.active)) - Project fields:
map({id, name}) - Rename keys:
with_entries(.key |= ascii_downcase)
CSV / TSV Export
- CSV row:
[.id, .name] | @csv - Bulk export:
jq -r '.[] | [.a,.b] | @csv' - TSV for spreadsheets:
@tsv
Aggregations
- Count:
length - Sum:
[.[] | .qty] | add - Group:
group_by(.status)
CI & DevOps
- Read kubectl output:
kubectl get pods -o json | jq - Read terraform state:
terraform show -json | jq - Build dynamic JSON:
jq -n --arg v "$X" '{val: $v}'
Validation
- Type check:
type == "number" - Required fields:
all(has("id")) - Fail loudly:
if bad then error("…") else . end
Frequently Asked Questions
What does | do in jq?
The pipe sends the output of the filter on the left as the input of the filter on the
right. .users[] | .email iterates each user and
projects the email — exactly like a shell pipe, but for JSON values.
Why does my filter return multiple lines?
jq filters are streams: a single filter can emit zero, one, or many JSON
values. .items[] emits each item separately. Wrap
it in [ ... ] to collect the stream back into
one array.
How do I get raw strings without quotes?
Use the -r flag: jq -r '.users[].email' prints each email on
its own line with no quoting — ideal for piping into xargs or shell loops.
What's the difference between .foo and .foo??
Both project a field. .foo raises an error
when the input is not an object; .foo? swallows the error and emits nothing.
Use the optional form when iterating heterogeneous data.
How do I filter array items by a condition?
Combine .[] with select(...): .orders[] | select(.status == "shipped") emits only the shipped orders. Wrap in [...] to keep them as one array.
How do I pass a shell variable into jq?
Don't interpolate it into the jq program — use --arg (string) or --argjson (JSON): jq --arg q "$USER" '.users[] | select(.name == $q)'.
Safer and handles quoting for you.
How do I merge two JSON files?
Read both into one array with -s (slurp),
then add them: jq -s '.[0] * .[1]' a.json b.json.
The * operator does deep merge for objects; + does shallow merge.
Why are my regex backslashes being eaten?
The shell consumes one layer of backslashes before jq sees the program. To match a
literal digit (regex \d) inside a jq
filter, use '\\d' in single-quoted shell
strings, or "\\\\d" when double-quoted.
Where can I try filters without leaving the browser?
Use the jq Query Tester — paste any JSON, write a filter, and see live results without installing anything.
Want to try jq filters in your browser?
Paste any JSON, write a jq expression, and preview the transformed output instantly — 100% client-side with sample queries and inline errors.